SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Zealot HardinComp's Avatar
    Join Date
    May 2003
    Location
    Boston, MA
    Posts
    171
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy MySQL Syntax problem

    I'm using a MySQL database to keep track of upcoming events for a website I manage, and I get no problems on my test server (running MySQL 4.0.14-nt). Unfortunately when I change the page to look for the production database (running MySQL 4.0.1) I get an error message when connecting. Here is the SELECT Query I use on my page http://hardincomp.port5.com/Revelation/index.php:

    Code:
    SELECT *
    FROM events
    WHERE EventDate >= DATE_SUB(CURRENT_DATE, INTERVAL 1 DAY) AND EventDate <= DATE_ADD (CURRENT_DATE, INTERVAL 30 DAY)
    ORDER BY EventDate
    I can post a field listing if needed, but here is the error I get from PortlandSQL:

    Code:
    You have an error in your SQL syntax near 'events WHERE EventDate >= DATE_SUB
    (CURRENT_DATE, INTERVAL 1 DAY) AND EventDate ' at line 1
    Is the difference between the versions of MySQL running on my comp and on the production server that different? And is there a workaround I can use? I really need to be able to limit the records shown on this page and I really don't want to have to go back to hand coding the page every time an event changes.
    J.M. Hardin
    My blog
    Registered Ubuntu User #10980

  2. #2
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What is the MySQL version on the server?
    Aaron Brazell
    Technosailor



  3. #3
    SitePoint Zealot HardinComp's Avatar
    Join Date
    May 2003
    Location
    Boston, MA
    Posts
    171
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry about that Sketch. I should have been more specific. I copied the message that I sent to the PortlandSQL group (not that I expect to get an answer there). The production server at PortlandSQL runs MySQL 4.0.1.
    J.M. Hardin
    My blog
    Registered Ubuntu User #10980

  4. #4
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    so both the dev and production servers are 4.1x. Versioning should be the issue. I'll look at this in more detail in a few....
    Aaron Brazell
    Technosailor



  5. #5
    SitePoint Zealot HardinComp's Avatar
    Join Date
    May 2003
    Location
    Boston, MA
    Posts
    171
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Have you been able to check on this Sketch? I have a workaround for it but it's a bit of a kludge and I'd rather do it the right way.
    J.M. Hardin
    My blog
    Registered Ubuntu User #10980

  6. #6
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry, been at the hospital delivering a kid with my wife. I'll look asap but I have to go nap right now...
    Aaron Brazell
    Technosailor




Bookmarks

Posting Permissions

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