Please help: Discuz database error

Source: Internet
Author: User
Tags php debug
Please help: Discuz database error, the prompt is as follows, how to solve? High finger points


Discuz! Database Error
(1062) Duplicate entry '4' for key 'primary'
Insert into auction_ovauctions SET 'id' = '4', 'uid' = '4', 'atnnum' = 'atn _ 100 ', 'atntitle' = 'NGC MS 63 nine years finalized', 'atncontent' = 'NGC MS 63 nine years finalized', 'atnprice' = '000000', 'bidtype' = '2 ', 'attrtype' = '11', 'bidcount' = '0', 'qprice' = '000000', 'aprice '= '000000', 'rprice' = '000000 ', 'baotui' = '1', 'tradtype' = '1', 'fareprice' = '', 'atnshtime' = '2016', 'ovtime' = '2016 ', 'filename' = '', 'mainpic '= '2017/154233naqborezf54q64pv.jpg', 'viewtimes '= '84', 'favtimes '= '0 ', 'bidtimes '= '13', 'status' = '2', 'bidnew' = '000000', 'shfr' = '0', 'shse' = '0 ', 'inputtime' = '000000'
PHP Debug
No. File Line Code
1 home. php 41 require_once (% s)
2 source/module/home/home_auction.php 64 require_once (% s)
3 source/include/auction/auction_bidden.php 68 table_auction_ovauctions-> add_ovacution (Array)
4 source/class/table/table_auction_ovauctions.php 16 discuz_database: insert (% s, Array, % d)
5 source/class/discuz/discuz_database.php 60 discuz_database: query (% 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 do not have this table, primary key (auto-increment)
Set the primary key ID to auto-increment

So how can I set automatic growth of primary keys in the database background?

Obviously, the primary key has the same value. here, when 'id' = '4' is inserted, the table already has the id = 4 value, so it is repeated, I don't know what your business is. if id is the primary key association of other tables, we recommend that you create an unrelated auto-increment primary key, and the associated id is only a field of this table. If the id is not associated with the primary key of other tables, do not set the id value of the primary key.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.