Jump to content

PHP mysql fetch array


tomcat01

Recommended Posts

Hi all

 

Need some help with the following please:

I want to fetch data from mysql but the id is part of an array

 

$ids = array("1","2","3");

$sql = mysql_query("SELECT * FROM table WHERE id ='$ids'") or die ("Error". mysql_error() );

 

This gives an obvious error but how can I get it to return the rows having ids 1 ,2 and 3 only! - It must not give me ids 5, 101 or 5 aswell should they exist. The array can be 20 values so I cant build it into the select.

 

Hope you understand what I'm looking for.

Please help me out on this one.Thanks

Link to comment
https://forums.phpfreaks.com/topic/37127-php-mysql-fetch-array/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.