Drop a table column

故事扮演 提交于 2019-12-04 05:35:47

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!