Cenron Posted June 20, 2008 Share Posted June 20, 2008 I dont know why but everytime I run this command via mysql_query() $sql = "SELECT `menu_id`,`module_id` FROM `module_menu` WHERE `menu_id`=0 OR (`menu_id`='1' AND `module_id`='7')"; then I call mysql_num_rows(); if(!mysql_num_rows($result)) { continue; } Without the `menu_id`=0 it works perfectly but when i put that `menu_id`=0 OR mysql_num_rows() always returns a true. I DONT KNOW WHY there is only one field in the database that the menu_id=0 so MAX it should return 2 rows but most of the time it should return 0. Any ideas? Link to comment https://forums.phpfreaks.com/topic/111163-phpdatabase-issue/ Share on other sites More sharing options...
andrewgarn Posted June 20, 2008 Share Posted June 20, 2008 missing quotes around the 0? WHERE `menu_id`= '0' Link to comment https://forums.phpfreaks.com/topic/111163-phpdatabase-issue/#findComment-570536 Share on other sites More sharing options...
Cenron Posted June 20, 2008 Author Share Posted June 20, 2008 tried both ways does nothing. Link to comment https://forums.phpfreaks.com/topic/111163-phpdatabase-issue/#findComment-570541 Share on other sites More sharing options...
Barand Posted June 20, 2008 Share Posted June 20, 2008 I DONT KNOW WHY there is only one field in the database that the menu_id=0 we don't know why either. Link to comment https://forums.phpfreaks.com/topic/111163-phpdatabase-issue/#findComment-570555 Share on other sites More sharing options...
widox Posted June 20, 2008 Share Posted June 20, 2008 How about it's a logic error. What do the rows in your DB look like? Need more info. Link to comment https://forums.phpfreaks.com/topic/111163-phpdatabase-issue/#findComment-570556 Share on other sites More sharing options...
Cenron Posted June 20, 2008 Author Share Posted June 20, 2008 the table is simple....It looks like this ID - int(11) AUTO_INCREMENT menu_id - int(11) module_id - int(11) Thats all there is to that table. Link to comment https://forums.phpfreaks.com/topic/111163-phpdatabase-issue/#findComment-570579 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.