Iain Simpson
Iain Simpson

Reputation: 469

Drop a table column

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());
        ?>

Upvotes: 0

Views: 4442

Answers (1)

gbn
gbn

Reputation: 432210

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)

Upvotes: 1

Related Questions