I am currently working on a project where I am required to make a list of entries from a SQL table where the id in the column is the same.
Here is the table:
+------+------+
|name |id |
+------+------+
|Ex1 |1 |
+------+------+
|Ex2 |2 |
+------+------+
I have tried the code below:
$query2 = "SELECT * FROM entries WHERE id = '$id'";
$data2=mysqli_query($link,$query2);
$row2=mysqli_fetch_array($data2);
$name = $row2["name"];
however that code only returns Ex2 and I would like it to return all the names with the id I specify in $id
Thanks in advance!
Aucun commentaire:
Enregistrer un commentaire