jf3000 Posted December 22, 2006 Share Posted December 22, 2006 Can someone please tell me what this means :[code]Invalid query: Duplicate entry '0' for key 1 Whole query: INSERT INTO add_log ( address, ref, browser) values( '10.1.1.1','http://blah.blah.blah','Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.4) Gecko/20060508 Firefox/1.5.0.4')[/code]Ip addy and website have been changed.I cant seem to understand what this type of error means, thank you. Quote Link to comment Share on other sites More sharing options...
mem0ri Posted December 22, 2006 Share Posted December 22, 2006 IMO (which isn't always perfect) you're trying to insert a repeated "key"...or unique identifier...and the DB is rejecting it. To avoid errors like this, I usually set up my SQL database with a generic "id" tag that auto-increments...and never try to hard-set it myself. Also...you can run with an INSERT INTO .... ON DUPLICATE KEY UPDATE... if you want to be able to update entries with an identical key that have shown up before... Quote Link to comment Share on other sites More sharing options...
jf3000 Posted December 22, 2006 Author Share Posted December 22, 2006 So to fix the error what is needed for me to do? I am all new to this, so I have somewhat an understanding what you have said, but I have played with thr database and, well I am lost. Quote Link to comment Share on other sites More sharing options...
trq Posted December 22, 2006 Share Posted December 22, 2006 Does this table have an auto incrimenting primary key? It should. It sounds like your trying to use one of those fileds as a primary key, and a primary key must be unique.Adding an auto incrimenting primary key to the field to the table ought fix it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.