I have a problem with a MySQL/PHP script. It's supposed to take a passed table name, and use it to drop the table and copy the default backup table (with data) to replace it (a sort of reset). The trouble, of course, is that it's not working. IS there something obvious I'm just missing?
PHP Code:
<?
$lnk = mysql_connect('localhost', 'username', 'password') or die (mysql_error());
mysql_select_db('databasename',$lnk);
$daydata=$_POST['passdate'];
$sqldrop = "DROP TABLE $daydata";
$sqlreset = "CREATE TABLE '$daydata' ('id' tinyint(4) NOT NULL auto_increment, 'start_time' int(11) NOT NULL default '0', 'end_time' int(11) NOT NULL default '0', 'time_label' text NOT NULL, 'name' text NOT NULL, 'image' text NOT NULL, 'info_link' text NOT NULL, PRIMARY KEY ('id')) TYPE=MyISAM; INSERT INTO '$daydata' SELECT * FROM '".$daydata."_Template'";
echo ($sqldrop);
echo ($sqlreset);
mysql_query($sqldrop) or die(mysql_error()); ;
mysql_query($sqlreset) or die(mysql_error()); ;
echo("The Schedule for ".$daydata." has been updated.</span>");
?>