Hello All,

I have a very strange problem which makes no sense to me whatsoever.

I am trying to find the number of queries that the people have dealt with
in a database between two dates. The dates are generated from some drop
down boxes and dropped into a variable. This is the code for the query.

$sql = 'SELECT Username, Count( Username ) FROM MainDetails, Usernames
WHERE MainDetails.UserID = Usernames.UserID and Date Between \'$Date1\'
and \'$Date2\' GROUP BY Username';

The strange thing is if I replace the $Date2 variable with a date manually
it works -. i.e. 

$sql = 'SELECT Username, Count( Username ) FROM MainDetails, Usernames
WHERE MainDetails.UserID = Usernames.UserID and Date Between \'$Date1\'
and \'2004-01-01\' GROUP BY Username';

This would indicate that the variable is wrong but it is not. The code to
generate the variable is exactly the same as $Date1 further more it echos
on screen and is creating the date in the format as entered in the manual
version?

Any ideas?


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to