A circular insert statement,
Insert into the db (` name `, ` value `) VALUES (' jack ', 'welcome')
With no problem, today on a win2008 system to run the program, tip:
Duplicate entry '0' for key 'PRIMARY'
A mystery!!!!!!!!!!
Using statements in your phpmyadmin insert directly, no problem, but the application running, too, will prompt the Duplicate entry '0' for key 'PRIMARY'!
Why???????
CodePudding user response:
Primary key repeat, look at the code is not generated on the primary keyCodePudding user response:
Print out look at the SQL in the programCodePudding user response:
Insert into the db (` id `, ` name `, ` value `) VALUES (null, 'jack', 'welcome');CodePudding user response:
Innodb tables? Is inserted before restart the database?CodePudding user response:
Program has a place to set by default to 0CodePudding user response:
See sql_mode variable is used NO_AUTO_VALUE_ON_ZERO, using only the NULL can be generated by a sequence numberCodePudding user response:
Check what's the difference between two machines of SQL mode,CodePudding user response:
Support the fifth floor's point of view, the program have a place to put the value of the initial value is set to 0,CodePudding user response:
Table AUTO_INCREMENT isn't be changedCodePudding user response:
Now that is on the primary key, then don't in the program into the button, the other fields should be no problemCodePudding user response:
Program has a place to set the value of the initial value to 0,CodePudding user response:
Innodb_autoinc_lock_mode=2CodePudding user response:
The specification of [1] innodb_autoinc_lock_modeInnodb_auto_lockmode has three values:
1, 0 this tradition traditional
2, 1 the said consecutive continuous
3, 2, the said interleaved