问题
Is the following correct? I am getting an error.
<?php
$form_id = $form->data['form_id'];
$query = mysql_query("
ALTER TABLE 'email_history' DROP '$form_id';
") or die(mysql_error());
?>
回答1:
Use ` (backtick) to delimit object names in MySQL. Try that
ALTER TABLE `email_history` DROP `$form_id`;
Note, I don't know php, but you can't parametrise DDL (ALTER TABLE
etc)
来源:https://stackoverflow.com/questions/8689324/drop-a-table-column