SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: SQL query issue

  1. #1
    SitePoint Member
    Join Date
    Jul 2012
    Location
    Chennai, Tamil Nadu, India
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    SQL query issue

    I've been trying to do this query (this is the result of echo statement of a query) and all fields & table exist. Yet, I do not know why I get this error. PHP & MySQL.

    Code:
    UPDATE monsterdata SET name = 'Sharks', type1 = 'earth', type2 = 'earth',Grade = 'B', hp=7,atk=2,def=3,spd=3,int=5,exp=20,evolvelvl=20,evolvesto=2,credits=15,evolutionlvl=1,maleratio=1,IsReleased=1,IsTokenOnly=0,IsStarter=0 WHERE id = 1

    #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 'int=5,exp=20,evolvelvl=20,evolvesto=2,credits=15,evolutionlvl=1,maleratio='1',Is' at line 1


    Please help!

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,509
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    INT is a reserved word. Change the name of that column, or put it between backticks.

  3. #3
    SitePoint Member
    Join Date
    Jul 2012
    Location
    Chennai, Tamil Nadu, India
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by guido2004 View Post
    INT is a reserved word. Change the name of that column, or put it between backticks.
    thanks man, I have no idea why I didn't see that. Fixed! Thanks a lot!

  4. #4
    SitePoint Member
    Join Date
    Jul 2012
    Location
    Delhi, India, India
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    INT is a preserved data type so u can 't use it as a variable and also put semicolon ( in the end.
    by we24support

  5. #5
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,341
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by we24support View Post
    INT is a preserved data type
    preserved?? that's an interesting way of saying don't use INT as a column name

    which has already been said


    Quote Originally Posted by we24support View Post
    ... and also put semicolon (;) in the end.
    that's totally optional, and has nothing to do with the posted error
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


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
  •