I'm trying to duplicate a row in a MySQL table while updating 2 fields. Here's the MySQL:
$sql = "
CREATE TEMPORARY TABLE links_temp SELECT * FROM links WHERE linkid=0 AND planid=8000;
UPDATE links_temp SET linkid=NULL, schoolid=285;
INSERT INTO links SELECT * FROM links_temp;
DROP TEMPORARY TABLE IF EXISTS links_temp;
And here's the error message generated:
Query Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UPDATE links_temp SET linkid=NULL, schoolid=285; INSERT INTO links SELECT * FRO' at line 2
Honestly, I'm going by what I've found on the web for doing this without fully understanding the syntax. That said, how can I correct my code and achieve my goal?