I need to know how to query a mysql database based on multiple and conditions…
im trying to find all male users online above age 18.
php code :
$sql = mysql_query("Select * FROM `users` where `round`= '".$userData["round"]."',
`sex` = 'm', `age` = '18', `online_stas` = 'online'
")or die(mysql_error());
Reading responses and the fact that you still have errors, I come to think the posibility of having “M” instead of “m” in
sexfield.You can try:
I removed the round check based on your statement that you want all male users online being older than 18, but can be added again.
Other posible fail can be the comparison of
agewith string value 18 instead of numeric value 18, so I changed that too (despite it may work and be converted automatically, but better to check with same types if something changes in a future).Try it and tell if it worked.