I’m doing an insert MySQL query in PHP with something like this:
$inserto= sprintf("INSERT INTO processing (orderid, ordert, usr, status, date, orderType) VALUES (%s, %s, %s, %s, %s, %s)",
GetSQLValueString($OID,"int"),
GetSQLValueString($tempbody,"text"),
GetSQLValueString($_COOKIE[TENNuser],"text"),
GetSQLValueString("0","int"),
GetSQLValueString(date("d-m-Y"),"text"),
GetSQLValueString('1','int'));
Sometimes it works fine, other times I get a duplicate entry error. I know why it’s happening, it’s because some orderid are technically the same sometimes (which is normal). The problem is that orderid isn’t the primary key. I have an “id” field that auto increments and THAT is the primary key.
Any idea what could be happening?
Didn’t check the indexes and there it was, the orderid field was set to UNIQUE.
It’s going to be a long day. Thanks Marc B.