inport of db gives me this error

Discussion in 'MySQL' started by harrisonford, May 17, 2008.

  1. #1
    this is my error



    Database error: Invalid SQL: SELECT count(id) as total FROM ads WHERE NOT EXISTS (SELECT * FROM click_history WHERE click_history.type='ptc' AND click_history.username='admin' AND click_history.ad_id=ads.id) and credits>=1 and (country='' or country='') and (daily_limit>views_today or daily_limit=0) and (upgrade='0' or upgrade='1')

    MySQL Error: 1064 (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 'upgrade='0' or upgrade='1')' at line 6)
    Session halted.

    is it an easy fix?

    thanks
     
    harrisonford, May 17, 2008 IP
  2. allaboutgeo

    allaboutgeo Peon

    Messages:
    85
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Use back ticks around upgrade. like

    (`upgrade`='0' or `upgrade`='1')
     
    allaboutgeo, May 17, 2008 IP
  3. allaboutgeo

    allaboutgeo Peon

    Messages:
    85
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    UPGRADE is a reserved word in MySQL. To use reserve words, you need to use back ticks around them. Here is a complete list of mysql reserved words.
     
    allaboutgeo, May 17, 2008 IP