Hello Guys.
I have table called "users" and I wanna make an exact copy as "users_2" as regard the structure only not the content.
I wanna do this using PHP only as I don't have an access to phpMyadmin or mysql console.
Do you have an idea how to do that ?
views:
39answers:
2
+7
A:
After connecting to your database appropriately in php (mysql_connect):
mysql_query("create TABLENAME like SRCTABLE");
Harley Green
2010-02-06 20:48:20
+1
A:
You can use the SQL SHOW CREATE TABLE users
command, its result is a CREATE TABLE
statement in which you can just replace users
with users_2
and execute.
Wim
2010-02-06 20:49:40