Tuesday, 27 August 2013

Fetching rows in array using SELECT * FROM table WHERE IN

Fetching rows in array using SELECT * FROM table WHERE IN

Hi I am trying to fetch data from a particular coloumn from all rows.
Eg Situation: DB Data: id, fbid, name
$sql = 'SELECT id FROM table WHERE table.fbid IN (1234,5678,4321)';
$sql_run = mysql_query($sql);
$sql_fetch = mysql_fetch_assoc($sql_run);
print_r($sql_fetch);
This returns the data when I test it using Sequel PRO or PHPmyAdmin. But
when I print the array it only displays one value.
Can you help me with a solution or tell me where I'm going wrong?

No comments:

Post a Comment