Ask for help: Discuz database error

Source: Internet
Author: User
Tags php debug
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.

  • 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.