Ask for help: Discuz database error, prompt as follows, how to solve? Looking for expert guidance
discuz! Database Error
(1062) Duplicate entry ' 4 ' for key ' PRIMARY '
INSERT into auction_ovauctions SET ' id ' = ' 4 ', ' uid ' = ' 4 ', ' atnnum ' = ' atn_201308041542338676 ', ' atntitle ' = ' NGC MS 639-year fine hair ', ' Atncontent ' = ' NGC MS 639 ', ' atnprice ' = ' + ', ' bidtype ' = ' 2 ', ' atntype ' = ' one ', ' bidcount ' = ' 0 ', ' qprice ' = ' April ', ' Apr Ice ' = ', ' rprice ' = ' 4000 ', ' baotui ' = ' 1 ', ' tradtype ' = ' 1 ', ' fareprice ' = ', ' atnshtime ' = ' 1375602243 ', ' ovtime ' = ' 1375 623686 ', ' atnyear ' = ', ' mainpic ' = ' 201308/04/154233naqborezf54q64pv.jpg ', ' viewtimes ' = ' a ', ' favtimes ' = ' 0 ', ' Bidtimes ' = ', ' status ' = ' 2 ', ' bidnew ' = ' 385 ', ' shfr ' = ' 0 ', ' shse ' = ' 0 ', ' inputtime ' = ' 1375602153 '
PHP Debug
No. File Line Code
1 home.php require_once (%s)
2 source/module/home/home_auction.php require_once (%s)
3 source/include/auction/auction_bidden.php table_auction_ovauctions->add_ovacution (Array)
4 source/class/table/table_auction_ovauctions.php Discuz_database::insert (%s, Array,%d)
5 source/class/discuz/discuz_database.php discuz_database::query (%s,%s,%s, false)
6 source/class/discuz/discuz_database.php 136 Db_driver_mysql->query (%s,%s, false)
7 source/class/db/db_driver_mysql.php 151 Db_driver_mysql->halt (%s,%d,%s)
8 source/class/db/db_driver_mysql.php 218 Break ()
Reply to discussion (solution)
You don't have this watch, primary key (autogrow)
Set the primary key ID to autogrow
How to set the primary key to automatically grow in the database background?
Obviously the primary key has the same value, in this case, when inserting ' id ' = ' 4 ', the table already has the value of id=4, so repeat, do not know what your business is, if the ID is the primary key association of other tables, it is recommended to establish an unrelated self-increment of the primary key, and the associated ID is only one field of the If the ID is not a primary key association for another table, do not set the ID value of the primary key.