Returning a total over a specified time from a single column

Hi,

I have written this query but it does not display anything. What I am attempting to do, is to add up a total of ‘flighttime’ column, and display it only for the current day. The flighttime column is structured as a varchar, not by time.

$query = 'SELECT (SELECT COUNT(*) FROM `flighttime` WHERE `pilotid` = ID) as total, submitdate * FROM db_pireps';		
$today = date('Y-m-d');
$submitdate = $query['submitdate'];
					
if($submitdate == $today)
{
      mysql_fetch_array($query);
}
echo $query->total;

couple of things.

  1. You have assigned $query to a string value, then you try to assign $submitdate by using $query as if it were an array - this won’t work

  2. You need to assign a variable to the result of mysql_fetch_array. You can then run through the values in the returned array with a foreach loop