[snip]
For example, if I create a record set of all male employees regardless
of eye color and then I want to create a table showing the totals of
people of each eye color. Is there a way to do this with out creating
several different recordsets.
[/snip]
Yes, you handle it in the query;
$sql =
[snip]
Another newbie question but how do I get the info out of a query when I
do a group by? How is it presented to me?
Would you mind taking your example 1 step farther and show me how I
would echo, say, the total of blue eyed people?
$sql = SELECT COUNT(eyeColor) AS colorCount, eyeColor FROM
[snip]
If you want blue eyes only you would handle that in the query;
SELECT COUNT(eyeColor) FROM theTable WHERE sex = 'male' AND eyeColor =
'blue'
And if your are returning one row ...
$result = mysql_fetch_object($db); // no while loop
echo We have . $result-colorCount . guys with .
3 matches
Mail list logo