DaveC426913
Programmer
My INSERT operation is returning a value that is different than the highest auto_incr value. Has it slipped up somewhere? Each time I run the operation, the mysql_insert_id() does increment, but the value is way down in the 1500's, even though the latest records created are in the 1700s.
My code:
$query1 = "INSERT INTO events (event_code,client_dbase,event_id,modified,beta_date,event_date,setup_date,
practice_date,derig_date,expiry_date,zone_type,event_type,audience_type,
viewers,quote_id,invoice_id,sales,pm,est_value,notes,ehi_status)
VALUES (NULL,'$clientDB','$eventID',NOW(),'$betaDate','$eventDate','$setupDate',
'$practDate','$derigDate','$expirDate','$zoneType','$eventType','$audncType',
'$viewers','$quoteID','$invoiceID','$sales','$pm','$value','$notes','100')";
$result1 = $Data->PostData($mainDB, $query1);
if ($result1){
$lastID = mysql_insert_id();
$reverse[$mainDB] = "DELETE FROM events WHERE event_code='$lastID'";
}
The above record (note the 'foo!') was just placed in the db as event_code 1710. However, the value I get back from mysql_insert_id(); is 1563. If I run this again, I'll get 1711 and 1564.
I know there is a value you can set that tells it where to start auto-incrementing from, is this the problem? While I do know how to set it in phpMyadmin, my avaiable choices are Webmin or the CommandLine, which I don't know how to do.
The database and the app were copied from another system by my sysAdmin, is that likely what caused the discrepancy?
My code:
$query1 = "INSERT INTO events (event_code,client_dbase,event_id,modified,beta_date,event_date,setup_date,
practice_date,derig_date,expiry_date,zone_type,event_type,audience_type,
viewers,quote_id,invoice_id,sales,pm,est_value,notes,ehi_status)
VALUES (NULL,'$clientDB','$eventID',NOW(),'$betaDate','$eventDate','$setupDate',
'$practDate','$derigDate','$expirDate','$zoneType','$eventType','$audncType',
'$viewers','$quoteID','$invoiceID','$sales','$pm','$value','$notes','100')";
$result1 = $Data->PostData($mainDB, $query1);
if ($result1){
$lastID = mysql_insert_id();
$reverse[$mainDB] = "DELETE FROM events WHERE event_code='$lastID'";
}
The above record (note the 'foo!') was just placed in the db as event_code 1710. However, the value I get back from mysql_insert_id(); is 1563. If I run this again, I'll get 1711 and 1564.
I know there is a value you can set that tells it where to start auto-incrementing from, is this the problem? While I do know how to set it in phpMyadmin, my avaiable choices are Webmin or the CommandLine, which I don't know how to do.
The database and the app were copied from another system by my sysAdmin, is that likely what caused the discrepancy?