OutOfInk Posted April 11, 2014 Share Posted April 11, 2014 I havew populated $llec as an array with nine teams and i need to extract all users who have bet on any of these options, ive tried everything i can think of so far so if someone has a solution would be awesome. Ive tried a for () statement as well with no luck. $i = 0; $puntBets = mysql_fetch_row(mysql_query("SELECT `name` , `bet` FROM `tablebets` WHERE `placed_on` = '$llec[$i]' AND `round` = '$round'")); $i++; Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted April 11, 2014 Share Posted April 11, 2014 you would implode the array to make it a comma separated list and use an IN() comparison in the query - http://dev.mysql.com/doc/refman/5.0/en/comparison-operators.html#function_in Quote Link to comment Share on other sites More sharing options...
OutOfInk Posted April 11, 2014 Author Share Posted April 11, 2014 Thanks mac_qyver, I've imploded them as so $imp = implode("', '", $llec); But mysql is still saying theirs an error with my array data SELECT `name` , `bet` FROM `table` WHERE `round` = '$round' AND `placed_on` IN ('Richmond','Carlton','Port Adelaide','GWS Giants','Hawthorn','West Coast','North Melbourne','Draw','Draw') I run this as a test and it said theirs a error Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted April 11, 2014 Share Posted April 11, 2014 knowing what error you got would help. Quote Link to comment 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.