I'm kinda new to PHP and I'm trying to copy information just passed into one table, and copy it to another, but I keep getting an error when I run the script.
the code goes like this:
// populate the table with the values $query = "INSERT INTO zones (store, locale, template, zoneName, content, editDate, editor) VALUES ('".$pageName."', '".$multLocales."', '".$tempName."', 'zone1', '".$zone1."', '".$editTime."', '".$editor."')"; mysql_query($query) or die('Query failed: '.mysql_error()); // put some of this info into the history table $query2 = "SELECT recnum, store, editor, zoneName, template, editDate INTO history FROM zones WHERE editDate='$editTime' AND zoneName='zone1'"; mysql_query($query2) or die('Zone1 Copy Query Failed: '.mysql_error());
The first query runs ok, and populates into the 'zones' table. the problem happens when the script gets to the second query - at that point, I get: "Zone1 Copy Query Failed: Undeclared variable: history"
'history' is the name of the second table, and it's not a variable. Both tables (zones, history) have these fields (although each has some other fields too), so they should be able to match up. Do they have to be in the exact same order? Does that matter?