$assault_checker=mysql_query("SELECT * FROM assaults WHERE host_id='".$_SESSION['user']."' OR guest_id='".$_SESSION['user']."' AND status='0'");
$assault_checker=mysql_num_rows($assault_checker);
I keep getting the wrong expected result. I just want to count the number of rows where the user id is in host_id or guest_id. Also the status row should be 0.
What am I missing?
yes you should use brackets, your query should be:
$assault_checker=mysql_query("SELECT * FROM assaults WHERE (host_id='".$_SESSION['user']."' OR guest_id='".$_SESSION['user']."') AND status='0'");