重命名MySQL表我想用SQL語句來重命名現有表:使用SQL語句
我已經嘗試:
1)mysql_query("RENAME '$renameFolder' TO '$newName'");
2)mysql_query("ALTER TABLE '$renameFolder' RENAME TO '$newName'");
3)mysql_query("RENAME TABLE '$renameFolder' TO '$newName'");
使用任何3條語句的我總是得到同樣的錯誤信息:
"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax"
請告訴我什麼即時做錯了!
嘗試:「重命名錶$ renameFolder TO $了newName」 – EricSonaron 2012-03-03 19:46:23
** WARNING **:'mysql_query'是一個過時的接口,不應在新的應用程序,因爲它是在PHP的未來版本中被刪除使用。像[PDO這樣的現代化替代品並不難學](http://net.tutsplus.com/tutorials/php/why-you-should-be-using-phps-pdo-for-database-access/)。如果您是PHP的新手,像[PHP The Right Way](http://www.phptherightway.com/)這樣的指南可以幫助解釋最佳做法。 – tadman 2015-02-02 16:28:23