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
  1. #1
    New Coder
    Join Date
    Jun 2009
    Posts
    44
    Thanks
    7
    Thanked 0 Times in 0 Posts

    What's wrong with this statement?

    Ugh, sorry guys, I've been looking at it the past 5 mins trying everything but I can't seem to insert this record into the table.

    Code:
    INSERT INTO history (username,index) VALUES ('john','0')
    Also tried
    Code:
    INSERT INTO history (username,index) VALUES ('john',0)
    Tablename: history
    username: Varchar of length 20
    index: int of length 1

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,852
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    index is a mysql keyword, so you can't use them in your queries as such.
    You may use back-ticks like `index`, but it's better to avoid using such words for the name of your table/field.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • Users who have thanked abduraooft for this post:

    Pembar (07-13-2009)

  • #3
    New Coder
    Join Date
    Jun 2009
    Posts
    44
    Thanks
    7
    Thanked 0 Times in 0 Posts
    That worked, Thanks.


  •  

    Posting Permissions

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