Question

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

Solution

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)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top