View Single Post
Old 06-23-2004, 10:51 AM   #7 (permalink)
metazai
Regular Contributor
 
Join Date: Apr 2004
Location: Orange County, CA
Posts: 125
metazai is on a distinguished road
Yeah, that line came from directly from phpmyadmin, actually (I used their PHP code creator button, under "Operations" for a table, to copy structure and content from the table to another with a different name, then I stripped out the fixed name and put in a variable.

Breaking down the queries doesn't seem to help. Again, it runs the first, the DROP, with no problem, but this code:

PHP Code:
<?
$lnk 
mysql_connect('localhost''username''password') or die (mysql_error()); 
mysql_select_db('database',$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"
$sqlinsert "INSERT INTO '$daydata' SELECT * FROM '".$daydata."_Template'";
mysql_query($sqldrop) or die(mysql_error());
mysql_query($sqlreset) or die(mysql_error());
mysql_query($sqlinsert) or die(mysql_error());
echo(
"The Schedule for ".$daydata." has been updated.</span>");
?>
Gives me this error message:

You have an error in your SQL syntax near ''Friday' ('id' tinyint(4) NOT NULL auto_increment, 'start_time' int(11) NOT NULL' at line 1
metazai is offline   Reply With Quote