Jump to content

Arrays in a mysql statement


OutOfInk

Recommended Posts

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++;

Link to comment
https://forums.phpfreaks.com/topic/287697-arrays-in-a-mysql-statement/
Share on other sites

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

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.