Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: php/mysql error

  1. #1
    Regular Coder mic2100's Avatar
    Join Date
    Feb 2006
    Location
    Scunthorpe
    Posts
    562
    Thanks
    15
    Thanked 28 Times in 27 Posts

    Question php/mysql error

    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.
    Code:
    $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

  • #2
    Senior Coder Mhtml's Avatar
    Join Date
    Jun 2002
    Location
    Sydney, Australia
    Posts
    3,531
    Thanks
    0
    Thanked 1 Time in 1 Post
    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
    Omnis mico antequam dominus Spookster!

  • #3
    Senior Coder
    Join Date
    Nov 2002
    Location
    North-East, UK
    Posts
    1,265
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •