Hello everyone!
I'm trying to get the total number of a certain records from a database,
but the result is always '1'. Please advise!
=MySql Table =
=activitiy =
id | employee_id | project_id | date
1 | 45 | 60 | 2003-09-09
2 | 34 | 10 | 2003-09-10
3 | 45 | 45 | 2003-09-10
4 | 23 | 30 | 2003-04-11
Now, I'm trying to get the following info:
- Total Number of employees in the datbase
- Total number of projects
-total number of projects per employee
I currently have
$_sql = "select count(*) as TotalRecords, count(employee_id) as
TotalEmployees, count(project_id) as TotalProjects GROUP BY employee_id,
project_id
$_qry = mysql_query($_sql) or die('...blah...');
$_res = mysql_fetch_object($_qry);
//output
echo $_res->TotalRecords; //prints nothing
echo $_res->TotalEmployees; // returns 1
echo $_res->TotalProjects; //also return 1
//end of code
Any suggestions? Did I miss something?
Please advise.
Thanks in advance.
_john
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php