...

View Full Version : php/mysql error



mic2100
02-16-2006, 11:11 AM
i have written this sql statement, i understand the code but am unsure y this doesn't work.


SELECT referrals.ReferralNum, referrals.CallbackDateAndTime, tblcallresult.CallResultDesc, referrals.AgentFK
FROM
referrals
INNER JOIN
tblcallresult ON (referrals.CallResultFK = tblcallresult.CallResultID)
WHERE
(referrals.AgentFK = %s)
AND
((referrals.CallResultFK = 6) OR (referrals.CallResultFK = 1))
AND (referrals.CallbackDateAndTime <= '%s')

It worked fine until i put in the last line which contains a date. (the god awful things)

this is the code that makes the date that i use in the above statement.

$date = date('Y-m-d 23:59:59');


and this is the error message that i receive when i run the page


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 '' at line 1:confused: :confused:

Mhtml
02-16-2006, 11:54 AM
Please don't cross post!


# 1.2) Do not crosspost- CodingForums.com is divided into various categories. When initiating a thread, always locate the most appropriate category, and post your question only ONCE, in that category. Do not post the same question in multiple categories.

http://www.codingforums.com/rules.htm

degsy
02-16-2006, 02:05 PM
Post your full code. You don't show where you date code is.

Also, you should echo your query before it is executed so you can see what the query would be.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum