I’m quite new to sql and I’m having trouble writing this
i have a table like this
id name
1 A
2 B
3 C
1 D
1 E
1 F
...
I want a query that will return to me the names of the ID i give it… say if i ask for 1, i want it to return A D E F
i tried this in PHP:
$result3 = mysql_query("SELECT name FROM table WHERE id='1'", $link);
$pfilearray=array();
$pfilearray=mysql_fetch_assoc($result3);
print_r($pfilearray);
but this gives me only the first name found with id 1, what am i missing?
You should iterate the whole result set using while() and mysql_fetch_assoc(). example: