pspfreak101 Posted October 19, 2008 Share Posted October 19, 2008 Ok I'm trying to get the statistics of how many approved entries their are (approved being 1) and how many unaproved entries (unaproved being 0) So my question is how can I just make it like this "Unaproved entries 10, Aproved entres 5" Here is my code if (@$_GET['action'] == 'dapprove') { if ($row["admin"] == "1") { $sql = "SELECT * FROM downloads"; $result = mysql_query ($sql); $row = mysql_fetch_array($result); $approved = ($row["approve"] == 1); $unaproved = ($row["approve"] == 0); if(empty($unaproved)) { $unaproved = 0; } echo "Their are ". $approved ." approved entries<br>"; echo "". $unaproved ." waiting for approval<br>"; }//End admin }//End dapprove Quote Link to comment https://forums.phpfreaks.com/topic/129037-solved-quick-question/ Share on other sites More sharing options...
Lamez Posted October 19, 2008 Share Posted October 19, 2008 what are you trying to do here: <?php $approved = ($row["approve"] == 1); $unaproved = ($row["approve"] == 0); ?> Quote Link to comment https://forums.phpfreaks.com/topic/129037-solved-quick-question/#findComment-668930 Share on other sites More sharing options...
pspfreak101 Posted October 19, 2008 Author Share Posted October 19, 2008 I'm trying to make it gather all the approved entries and telling me how many their are such as "6 approved entries" 1 and 0 stand for approved and disapproved So right now its not displaying all the entries and only says this "Their are 1 approved entries 0 waiting for approval" their is one approved entrie but 5 are not approved and yet it still says 0 Quote Link to comment https://forums.phpfreaks.com/topic/129037-solved-quick-question/#findComment-668931 Share on other sites More sharing options...
Garethp Posted October 19, 2008 Share Posted October 19, 2008 $App = mysql_query("SELECT * FROM table_name WHERE approved='1'");' $Approved = mysql_num_rows($App); $App = mysql_query("SELECT * FROM table_name WHERE approved='0'");' $NotApproved = mysql_num_rows($App); Quote Link to comment https://forums.phpfreaks.com/topic/129037-solved-quick-question/#findComment-668933 Share on other sites More sharing options...
.josh Posted October 19, 2008 Share Posted October 19, 2008 $sql = "select count(approve) as totals from downloads group by approve"; $result = mysql_query($sql); $unapproved = mysql_result($result, 0, 'totals'); $approved = mysql_result($result, 1, 'totals'); edited: forgot 3rd argument in mysql_result Quote Link to comment https://forums.phpfreaks.com/topic/129037-solved-quick-question/#findComment-668937 Share on other sites More sharing options...
pspfreak101 Posted October 19, 2008 Author Share Posted October 19, 2008 Thank you works perfect Quote Link to comment https://forums.phpfreaks.com/topic/129037-solved-quick-question/#findComment-668951 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.