我使用phpMyadmin作为数据库,但无法删除表...如何发现语法错误?
<?php
include 'dbconnect.php'; //connect to DB
//Droping The tables
$dropping = @mysql_query('DROP TABLE IF EXISTS rents, criticise, writesIn, writenIn, translated, reads, worksIn, inStock, playsIN, store, genre, employee, newspaper, customer, critic, language, actor, film, city ;');
if (!$dropping) {
exit('<p>Error dropping the tables<br />'.
'Error: ' . mysql_error() . '</p>');
}
if ($dropping) {
echo 'everything went just fine dropping the tables<br>';
}
最佳答案
reads
是reserved MySQL keyword。您需要将其括在反引号中:
DROP TABLE IF EXISTS rents, criticise, writesIn, writenIn, translated, `reads`, worksIn, inStock, playsIN, store, genre, employee, newspaper, customer, critic, language, actor, film, city