Jump to content

Invalid query error


jf3000

Recommended Posts

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.
Link to comment
https://forums.phpfreaks.com/topic/31603-invalid-query-error/
Share on other sites

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...
Link to comment
https://forums.phpfreaks.com/topic/31603-invalid-query-error/#findComment-146508
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.