Can anyone tell me what is wrong with this query? I have attempted several verisons of this but continue to get errors. I believe the problem is in the strtotime() call in the query due to the fact that I can get the query to work when I replace those calls with a real timestamp ...
I also need this to return an integer count of all "bugs" found that match the query, but I haven't even gotten this to return the query yet.
Here is is
function countbugs ($fromdate, $todate, $status) {
$fromdate and $todate are unix timestamps
$status is a String
bug_when is in the format of YYYY-mm-dd hh:mm:ss
#
include("include/dbconnect.php");
$result= mysql_query("select DISTINCT bugs.bug_id from bugs_activity, bugs where (
(bugs_activity.bug_id = bugs.bug_id)
AND
((bugs_activity.added='$status')
AND
(strtotime('bugs_activity.bug_when') >= '$fromdate')
AND
(strtotime('bugs_activity.bug_when') <= '$todate'))
OR
(strtotime('bugs.creation_ts') >= '$fromdate'
AND
strtotime('bugs.creation_ts') <= '$todate'
AND
('bugs.bug_status' = 'NEW')))
ORDER by
strtotime('bugs.creation_ts')"
,$db);
print "\n " . mysql_error() . "\n";
return $result;
}