OK. So I'm thinking that the alias thing was my problem before, because if I implement the following changes:
$lock_query = "LOCK TABLES ofrearchive WRITE, ofrelistings WRITE";
to:
$lock_query = "LOCK TABLES ofrearchive WRITE, ofrearchive AS ofrearchive1 WRITE, ofrelistings WRITE, ofrelistings AS ofrelistings1 WRITE";
and:
$insert_query = "INSERT INTO ofrearchive
SELECT * FROM ofrelistings LEFT JOIN ofrearchive USING(uniqueid)
WHERE ofrearchive.uniqueid IS NULL AND DATEDIFF(ofrelistings.dateadded, now())>30";
to:
$insert_query = "INSERT INTO ofrearchive
SELECT * FROM ofrelistings LEFT JOIN ofrearchive AS ofrearchive1 USING(uniqueid)
WHERE ofrearchive1.uniqueid IS NULL AND DATEDIFF(ofrelistings.dateadded, now())>30";
I don't get that error anymore. However, I tried that and now this is the error I'm getting:
Column count doesn't match value count at row 1
I can't even figure out what this error is referring to. Any thoughts?