Thanks Xenon, I have added a line also so I could find out a little more and here is what I get now:
"I failed and here is why: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'Resource id #14' at line 1
"
If I run the query directly in Mysql it returns the results correctly. Any ideas? Thanks for the help!
Quote:
<?PHP
require("./global.php");
$start_date = "2004-08-01 00:00:00";
$end_date = "2004-08-23 00:00:00";
$stmt = $DB_site->query("SELECT COUNT(post.postid) AS count, user.username
FROM post
LEFT JOIN user ON (user.userid = post.userid)
AND (UNIX_TIMESTAMP('$start_date')) <= post.dateline
AND post.dateline <= (UNIX_TIMESTAMP('$end_date'))
GROUP BY user.userid ORDER BY count DESC, username");
$sr = mysql_query($stmt) or die ("<p>I failed and here is why: " . mysql_error());
?>
|