Time Posted August 9, 2006 Share Posted August 9, 2006 I was wondering how i can count all the rows in a table where the `ID` field equals '1' and the `to_id` field equals '2', or where the `ID` field equals 1 and the `from_id` field equals '3'.This is what i have but it doesn't work:[code=php:0]$count = mysql_num_rows(mysql_query("SELECT * FROM `mail` WHERE (`ID` = '1' AND `to_id` = '2') OR (`ID` = '1' AND `from_id` = '3')"));[/code] Quote Link to comment https://forums.phpfreaks.com/topic/17017-or-mysql-problem/ Share on other sites More sharing options...
Daniel0 Posted August 9, 2006 Share Posted August 9, 2006 [code]SELECT count(*) FROM bla bla bla rest of query[/code] Quote Link to comment https://forums.phpfreaks.com/topic/17017-or-mysql-problem/#findComment-71823 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.