¿Cómo obtener el valor de ID de una fila de datos en la tabla de datos?

Actually, I have at ver.php

$con=mysqli_connect("localhost","root","123","Persons");
$sql="SELECT * FROM Persons";
$rs=mysqli_query($con,$sql);

I tried to databinding into a table, and everything is ok. BUT when i come to think about this: Then how to get ID of datarow that u put into table???

|ID|Name|button (press it and user will go to Lookup.php and post value for that page).

but if i let the button have the value is the ID of datarow then on the table will have:

ID|Name|Choose
 1|John|(1)

but i want the button have text is "+" and when user press, it will "POST" a value "1" to Lookup.php Sorry, i am a application programmer. I am trying to convert my application to website application by coding. Could someone give me a hint? Thank in advance.

preguntado el 27 de noviembre de 13 a las 02:11

1 Respuestas

You can get the last inserted id IF THE ID FIELD IS AUTO INCREMENTING like this http://dev.mysql.com/doc/refman/5.0/en/getting-unique-id.html

Or you can do like this

$id;

while($row = $rs->fetch_array($result)){
    $id= $row['id']; // You will get your id's here
}

respondido 27 nov., 13:02

i DID say" everything is ok". because i can get it but the issue is how to post the ID value to anothe page when user press the button at the end of that row.NOTICE: the button must not have ID column's value. - Prohibido

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.