Jump to content

[SOLVED] Quick Question


pspfreak101

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/129037-solved-quick-question/
Share on other sites

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

$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

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.