| Index
» Projekty
» phpMyEdit
» Fórum
» How to get auto increment to work |
 |
cwright
Založený: 15.09.2008
Príspevky: 5
Zaslal: 2008-09-15 18:34
Návrat hore
Odpovedať s citátom
|
My code is:
$opts['fdd']['id'] = array(
'name' => 'id',
'select' => 'T',
'options' => 'AVCPDR', // auto increment
'maxlen' => 11,
'sort' => true
My id field ranges from 1 to 1056 and is an integer type. I can add one record which gets assigned an id of 0. After that I cannot add records and am getting an MySQL error 1062 Duplicate entry '0' for key 1. It keeps wanting to use 0 for the id.
How can I get the auto incrementing to work. Where is the code to add 1 to the id field or do I need to get into triggers to make this happen.
Thanks
|
cwright
Založený: 15.09.2008
Príspevky: 5
Zaslal: 2008-09-15 19:02
Návrat hore
Odpovedať s citátom
|
If you can't tell from my post, I'm new to phpmyedit and mysql.
The problem was not with phpMyEidt but rather simply the configuration of my table. The id field needed to be set to "Auto increment".
I fixed it using phpMyAdmin and making my id field "auto increment" under the "extra" setting. The SQL was an alter table command:
ALTER TABLE `tablename` CHANGE `id` `id` INT( 11 ) NOT NULL AUTO_INCREMENT
Maybe this will help someone else out.
Thanks all.
|
|
Odoslať novú tému
Odpovedať na tému
|
|
|
|