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>"; } 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". 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 ? 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. 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 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? Link to comment https://forums.phpfreaks.com/topic/87959-count-or-sum/#findComment-451439 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.