0

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());
        ?>
Kara
  • 6,115
  • 16
  • 50
  • 57
Iain Simpson
  • 441
  • 4
  • 13
  • 29
  • It should be: `ALTER TABLE email_history DROP COLUMN column_name;` – Yaniro Dec 31 '11 at 16:57
  • Hi, im using a dynamic value generated by the $form_id , it is equal to (the current column name selected), I have it sorted now, I just was using the wrong (')s – Iain Simpson Dec 31 '11 at 17:03

1 Answers1

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)

gbn
  • 422,506
  • 82
  • 585
  • 676