RE: What is causing duplicate keys?
| From: | Rick Emery | Date: | Wed, 05 Dec 2001 19:37:27 +0000 |
| Subject: | RE: What is causing duplicate keys? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-76768@lists.php.net to get a copy of this message | ||
it should read: INSERT INTO recensioni VALUES( NULL,...
In order fot auto_increment to work, you must use NULL. When you tried
NULL, what SPECIFIC error did you get when it complained?
FYI: it complains about the "duplicate key" because you already inserted a
record with 300 in the PRIMARY KEY field. When you attempt to insert the
next key with 300, that is an error.
-----Original Message-----
From: mweb [mailto:mweb@inwind.it]
Sent: Wednesday, December 05, 2001 1:16 PM
To: mysql@lists.mysql.com; php-general@lists.php.net
Subject: What is causing duplicate keys?
Hello,
Always struggling on my php-odbc-MS access project, I managed to
successfully
add a record to a table.
Now, no matter what I write in the first field (random numbers, AUTO,
AUTO_INCREMENT...)
I get this:
Insert Into recensioni VALUES (300, 'riee', 'reworew', 'wer',
2001,'IT',
2.5,
'dond to it, 'rew', 'uno',1, 'Caro', 3, 'stuff',
20011205201040, 'writeurl, 1, '5/12/2001 20.10.40', '1',
'1','enter
keyword')
Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] The changes
you
requested to the table were not successful because they would create
duplicate
values in the index, primary key, or relationship. Change the data in the
field or fields that contain duplicate data, remove the index, or redefine
the index to permit
duplicate entries and try again., SQL state 23000 in SQLExecDirect in
C:\domini\mnet\inser_rec.php on line 109
Error in odbc_exec( no cursor returned )
How can I find out what I am duplicating? The first field is the unique key,
but what should I send to Access to tell it just auto increment and go?
If I put 0 or NULL it complains.
Also, Andrew Hill siggested the use of odbc_tables and odbc_columns to get
info about the structure of each column which I don't know in detail because
the DB was written by the guy who quit, not me....)
What is the exact syntax of those instructions? I have tried to apply the
manual, but without success on the second one.
TIA,
mweb
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <mysql-thread93162@lists.mysql.com>
To unsubscribe, e-mail <mysql-unsubscribe-remery=excel.com@lists.mysql.com>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php