Help with only showing values above 0 [RESOLVED]
Posted: Tue Jul 06, 2010 1:12 pm
This mysql query grabs 2 specific error codes from my database.
This code outputs the data from the mysql query to the screen.
Example Output:
444 Errors: 0
555 Errors: 13
I only want the output to show values that are greater than 0, anything that has the value 0 I do not want to be listed on the output.
Example Output of what I want:
555 Errors: 13
Any help on how to do this would be great, as I am still a php/mysql newb.
Thanks
Code: Select all
$query = "select '4444' as 'error code', count(*) as 'total' from table where desc like '%error: 4444%'
union select '5555' as 'error code', count(*) as 'total' from table where desc like '%error: 5555%'Code: Select all
$i= 0;
while ($i < $num) {
$row = mysql_fetch_array($result);
echo "<B> $row[0] Errors: </b>";
echo $row[1], "<br />";
$i++;
}444 Errors: 0
555 Errors: 13
I only want the output to show values that are greater than 0, anything that has the value 0 I do not want to be listed on the output.
Example Output of what I want:
555 Errors: 13
Any help on how to do this would be great, as I am still a php/mysql newb.
Thanks