Hi,

I am using IN array with my where clause in mysql query.

My query goes like this :-

$sql = mysql_query("SELECT * FROM table1 where id IN ('$id_array')");

The problem is when I echo the query, I see 'Array' in the query instead of the id's.
Please help

That's right, the SQL expects a comma separated list of values. You can do this using explode

$sql = mysql_query('SELECT * FROM table1 WHERE id IN (' . explode(',', $id_array) . ')');
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.