how do i release the auto increment serial nos that are missing
Posted
by
mmdel
on Stack Overflow
See other posts from Stack Overflow
or by mmdel
Published on 2012-11-11T10:58:51Z
Indexed on
2012/11/11
10:59 UTC
Read the original article
Hit count: 299
mysql
i have a table with auto increment field and i am using transactions when inserting new data. now i find there are a few serial nos that are missing. suppose the last serial no was 475, now when i insert new row, the serial allotted to it is 481. how do i correct this.
table_A fields ID(Auto increment),Name,Address table_B fields ID(Auto increment FK TO table_A ID),Tel,Fax,Email,Salesman table_C fields ID(Auto increment FK TO table_A ID),monthly_commitment
mysql_query(BEGIN);
$a = mysql_query("INSERT INTO table_A VALUES('','name','address')");
$b = mysql_query("INSERT INTO table_B VALUES('','tel','fax','email','salesman')");
$b = mysql_query("INSERT INTO table_C VALUES('','monthly commitment')");
if(($a) && ($b) && ($c)){mysql_query("COMMIT");} else {mysql_query("ROLLBACK");}
© Stack Overflow or respective owner