mjfroggy
01-22-2010, 03:18 PM
Hello
I am trying to count the number of hours someone has spent in a classroom setting.
So I have a mysql table with username, class_start_date , class_end_date
so each user could have multiple rows. So I need to for each row where the username equals a specific username get the # days between the class start and class end and then copunt the total number of hours based on an 8 hour work day.
so like
John Doe 2010-01-01 | 2010-01-02
John Doe 2009-12-11 | 2010-12-12
total classroom hrs 32 hrs
So can someone let me know what a mysql query might look for this
I tried
$sql = mysql_query("SELECT DATEDIFF('Class_startdate', 'Class_enddate') AS Days FROM Training_classes where Trainer='$inst'");
$result = mysql_fetch_array($sql);
extract($result);
echo "$Days";
I am trying to count the number of hours someone has spent in a classroom setting.
So I have a mysql table with username, class_start_date , class_end_date
so each user could have multiple rows. So I need to for each row where the username equals a specific username get the # days between the class start and class end and then copunt the total number of hours based on an 8 hour work day.
so like
John Doe 2010-01-01 | 2010-01-02
John Doe 2009-12-11 | 2010-12-12
total classroom hrs 32 hrs
So can someone let me know what a mysql query might look for this
I tried
$sql = mysql_query("SELECT DATEDIFF('Class_startdate', 'Class_enddate') AS Days FROM Training_classes where Trainer='$inst'");
$result = mysql_fetch_array($sql);
extract($result);
echo "$Days";
