Zepo. Posted August 4, 2008 Share Posted August 4, 2008 This seems to completely ignore the left join. $total=mysql_query("SELECT COUNT(*) FROM `mybb_offers` a LEFT JOIN mybb_offerscompleted c ON a.ID = c.ID AND userid='$user_row[uid]' WHERE a.`cat` = '$cat' AND `MID` = 'no' AND c.ID IS NULL "); $total=mysql_fetch_array($total); $total="$total[0]"; Link to comment https://forums.phpfreaks.com/topic/118049-select-count-error/ Share on other sites More sharing options...
genericnumber1 Posted August 4, 2008 Share Posted August 4, 2008 $total=mysql_query("SELECT COUNT(*) FROM `mybb_offers` a LEFT JOIN mybb_offerscompleted c ON a.ID = c.ID AND userid='$user_row[uid]' WHERE a.`cat` = '$cat' AND `MID` = 'no' AND c.ID IS NULL ") or die(mysql_error()); // <----- add me! Link to comment https://forums.phpfreaks.com/topic/118049-select-count-error/#findComment-607289 Share on other sites More sharing options...
Zepo. Posted August 4, 2008 Author Share Posted August 4, 2008 It does not display any errors. Link to comment https://forums.phpfreaks.com/topic/118049-select-count-error/#findComment-607760 Share on other sites More sharing options...
lemmin Posted August 4, 2008 Share Posted August 4, 2008 I don't think your data is what you are expecting, based on that query. Try putting the "userid='$user_row[uid]'" part in the WHERE clause. Link to comment https://forums.phpfreaks.com/topic/118049-select-count-error/#findComment-607762 Share on other sites More sharing options...
Zepo. Posted August 4, 2008 Author Share Posted August 4, 2008 Well the thing is it works on a loop i have on anouther page. What i'm trying to do is leave out all the entrees with the id that matches the id in anouther table with the same userid. Link to comment https://forums.phpfreaks.com/topic/118049-select-count-error/#findComment-607770 Share on other sites More sharing options...
ainoy31 Posted August 4, 2008 Share Posted August 4, 2008 wouldn't you need to use an alias for the userid and MID as well? Link to comment https://forums.phpfreaks.com/topic/118049-select-count-error/#findComment-607940 Share on other sites More sharing options...
Zepo. Posted August 4, 2008 Author Share Posted August 4, 2008 wouldn't you need to use an alias for the userid and MID as well? I don't believe so. Link to comment https://forums.phpfreaks.com/topic/118049-select-count-error/#findComment-608078 Share on other sites More sharing options...
Zepo. Posted August 5, 2008 Author Share Posted August 5, 2008 Anyone? Link to comment https://forums.phpfreaks.com/topic/118049-select-count-error/#findComment-608281 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.