MYSQL SELECT COUNT displayed in PHP
Posted: Thu Jan 06, 2005 3:05 pm
I am trying to view data statistics from my MySQL database. I have the SQL query just fine, but I can't seem to display the information with php:
SELECT gender, COUNT(gender) AS number FROM links GROUP BY gender ORDER BY gender
The Result should be:
gender number
Female 15934
Male 19707
This works fine with SQL, but I can't seem to get it to echo this information in php to be displayed in a browser. I also need to execute multiple SELECT queries to get all statistics in this links table at once.
If you could help. then I would appreciate it. I allready searched the forums for an answer, but no luck. Only code to dislplay the number of rows, but that is not what I want.
Also, if you know how this can also be displayed graphically, then that would be a difinate plus.
v/r,
Robert
SELECT gender, COUNT(gender) AS number FROM links GROUP BY gender ORDER BY gender
The Result should be:
gender number
Female 15934
Male 19707
This works fine with SQL, but I can't seem to get it to echo this information in php to be displayed in a browser. I also need to execute multiple SELECT queries to get all statistics in this links table at once.
If you could help. then I would appreciate it. I allready searched the forums for an answer, but no luck. Only code to dislplay the number of rows, but that is not what I want.
Also, if you know how this can also be displayed graphically, then that would be a difinate plus.
v/r,
Robert