Scenario: I have approximatly 100 monitor's that I am trying to track in our office. I want to list the monitor's from a database by CRT's and LCD's. I then want to place the information in a table that will list the number of 15" CRT's, 17" CRT's and 21" CRT''s. I then want to do the same with LCD. Along with this I want to give a total number of monitors.
First:
Code: Select all
<?php
$sqlmonitors = "SELECT * FROM monitor";
$result = mysql_query($sql) or die("<b>MySQL Error 1:</b> ".mysql_errno()." : ".mysql_error());
$numrows = mysql_numrows($result);
?>Code: Select all
<?php
$x=0;
while($x<$numrows){
$array = mysql_fetch_assoc($result);
while (list($indice,$crt) = each($array)){
if ($crt=="LCD"){
$num = count($crt);
echo $num;
}
}
$x++;
}?>