...

View Full Version : What's wrong with this statement?



Pembar
07-13-2009, 09:18 AM
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.


INSERT INTO history (username,index) VALUES ('john','0')

Also tried

INSERT INTO history (username,index) VALUES ('john',0)


Tablename: history
username: Varchar of length 20
index: int of length 1

abduraooft
07-13-2009, 09:34 AM
index is a mysql keyword (http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html), 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.

Pembar
07-13-2009, 09:47 AM
That worked, Thanks.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum