I want to rename an existing table using SQL statement:
I have already tried:
mysql_query("RENAME '$renameFolder' TO '$newName'");
mysql_query("ALTER TABLE '$renameFolder' RENAME TO '$newName'");
mysql_query("RENAME TABLE '$renameFolder' TO '$newName'");
Using any of the 3 statements I'm always getting the same error message:
"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax"
Please tell me what I'm doing wrong!
Try using backquotes instead, e.g.:
mysql_query( "RENAME TABLE `" . $renameFolder . "` TO `" . $newname . "`" );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With