Link to home
Start Free TrialLog in
Avatar of rgb192
rgb192Flag for United States of America

asked on

delete table and have auto increment primary key start back at 1

mysql_query("drop table $table;");
mysql_query("create table $table like $oldtable;");


these php commands are not running
but these commands run in the mysql query editor


I want to do
delete from table
but I have an auto increment primary key

I want to delete table and have auto increment primary key start back at 1
ASKER CERTIFIED SOLUTION
Avatar of Kevin Cross
Kevin Cross
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rgb192

ASKER

truncate table tablename worked in a mysql workbench query editor

but not with php

mysql_query("truncate table $table");
Avatar of rgb192

ASKER

truncate works
 on php and mysql query editor
thanks