2

Query that is being ran:

INSERT INTO `log_url` (`url_id`, `visitor_id`, `visit_time`) VALUES (?, ?, ?)

Error that is being thrown:

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '41721' for key 1

Where does 41721 fall into? How do I read this? How do I check the 'key 1'?

1 Answer 1

2

Run this command : SHOW CREATE TABLE log_url\G

This will give you a display of the SQL needed to create the table.

It will also show you the indexes and constraints for that table.

The first index (key 1) in that table must have a column called url_id.

From the error message, you are being told that there exists a row in log_url that has 41721 already present. You can verify this with SELECT * FROM log_url WHERE url_id = 41721;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.