My code, which archives old members from a membership database, when run, returns
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DELETE FROM members WHERE member_ref = 155' at line 5.
It should copy the entry to the identical 'archive' table from 'members' and delete the original in members.
$ref = '155';
$leave = mysql_query(" INSERT INTO archive
SELECT *
FROM members
WHERE member_ref = ".$ref.";
DELETE FROM members
WHERE member_ref = ".$ref ) or die(mysql_error());
I know I should be using mysqli but I haven't had time to standardise the whole system (~120 pages) from mysql to mysqli.
It's parsing 155 into the second $ref
Using the phpmyadmin's SQL window and entering the following works perfectly.
INSERT INTO archive
SELECT *
FROM members
WHERE member_ref = 155;
DELETE FROM members
WHERE member_ref = 155
What am I missing?