balkan7 Posted January 26, 2008 Share Posted January 26, 2008 i wanna count from client_id how many banners are active, but wrong result whit my code: $numrows = mysql_query("SELECT client_id, COUNT(*) AS total_banners FROM ".$db_prefix."banners WHERE banner_status = '1' GROUP BY client_id"); while ($num = mysql_fetch_assoc($numrows)){ echo "<td align='center' class='small'>".$num['total_banners']."</td>"; } Quote Link to comment https://forums.phpfreaks.com/topic/87959-count-or-sum/ Share on other sites More sharing options...
fenway Posted January 26, 2008 Share Posted January 26, 2008 Define "wrong". Quote Link to comment https://forums.phpfreaks.com/topic/87959-count-or-sum/#findComment-450128 Share on other sites More sharing options...
balkan7 Posted January 27, 2008 Author Share Posted January 27, 2008 what i need for get result propertly ? client_id banner_status counting or sum ? Quote Link to comment https://forums.phpfreaks.com/topic/87959-count-or-sum/#findComment-450561 Share on other sites More sharing options...
fenway Posted January 27, 2008 Share Posted January 27, 2008 what i need for get result propertly ? I don't know, since you're not giving us (a) the expected results or (b) the current results. Quote Link to comment https://forums.phpfreaks.com/topic/87959-count-or-sum/#findComment-450701 Share on other sites More sharing options...
balkan7 Posted January 28, 2008 Author Share Posted January 28, 2008 ok i wanna get this result client_id active banners 3 2 7 1 9 3 62 1 Quote Link to comment https://forums.phpfreaks.com/topic/87959-count-or-sum/#findComment-451318 Share on other sites More sharing options...
fenway Posted January 28, 2008 Share Posted January 28, 2008 And what does it produce now? Quote Link to comment https://forums.phpfreaks.com/topic/87959-count-or-sum/#findComment-451439 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.