468,540 Members | 1,717 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,540 developers. It's quick & easy.

IN clause in php mysql

I need to retrieve all rows which suits a set of values in an array. Now am using
$bound = implode(",",$arr);


$sqls="SELECT * FROM main where area IN ( $bound )";
Oct 19 '11 #1
1 1450
Rabbit
12,513 Expert Mod 8TB
That'll work if you're only using numeric data types. If it's a string, you need to surround each value in single quotes.
Oct 19 '11 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Rahul Anand | last post: by
6 posts views Thread by Xenophobe | last post: by
1 post views Thread by NotGiven | last post: by
8 posts views Thread by Jerry | last post: by
5 posts views Thread by pwiegers | last post: by
Atli
6 posts views Thread by Atli | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.