AV1611 Posted November 19, 2008 Share Posted November 19, 2008 what am I doing wrong? $LIST[0]=1; /for demonstration purposes $LIST[1]=7; /for demonstration purposes $result=mysql_query(select * from table where field IN $LIST); You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Array' at line 1 Quote Link to comment https://forums.phpfreaks.com/topic/133387-what-am-i-doing-wrong/ Share on other sites More sharing options...
gevans Posted November 19, 2008 Share Posted November 19, 2008 $LIST=1; /for demonstration purposes $LIST.=7; /for demonstration purposes $result=mysql_query(select * from table where field IN $LIST); Quote Link to comment https://forums.phpfreaks.com/topic/133387-what-am-i-doing-wrong/#findComment-693748 Share on other sites More sharing options...
premiso Posted November 19, 2008 Share Posted November 19, 2008 $LIST is an array. If you want to do an IN on it try this: $list[0] = 1; $list[1] = 7; $lists = implode("', '", $list); $result=mysql_query("select * from table where field IN('" . $lists . "')"); Should work. Quote Link to comment https://forums.phpfreaks.com/topic/133387-what-am-i-doing-wrong/#findComment-693749 Share on other sites More sharing options...
AV1611 Posted November 19, 2008 Author Share Posted November 19, 2008 haven't done it yet, but I already know implode will fix it thanks... I just forgot how to make it wokr Quote Link to comment https://forums.phpfreaks.com/topic/133387-what-am-i-doing-wrong/#findComment-693751 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.