|
Posted by _Raven on 08/17/06 14:38
I am getting an error when adding info to table. I am getting mysql error
for duplicate entry.
The column is a unique one, but the data I'm inserting is unique from the
other entries.
The script WILL insert the new data into the table, but it will say that the
data is already there???
I get mysql error 'duplicate entry for key 2'. I have even tried entering
garbage for key 2, stuff like 'iusfoidsousussusdiudsi'
and I still get dup key error (but it adds it anyways??)
mysql_affected_rows() returns -1.
I don't understand what I'm doing wrong.
$sql = "INSERT INTO mytable (uid,name,state) VALUES (1,'joe','texas')";
$query = mysql_query($sql);
if(!$query){
$message = 'failed. ERROR: ' . mysql_error() . ' SQL: ' . $sql;
}else{
$message = 'Data Added';
}
Now in the example above, joe is not in the table, nor is any name there
even similar to joe.
The query will be successful, but I still get the duplicate entry error?
grrrrrrr
Any help would be appreciated!
Navigation:
[Reply to this message]
|