I have two tables, projects
and archive
with identical columns. As you understand, I need to archive projects in the archive
table, under certain conditions.
I wrote two requests, and they work fine if executed separately, but I'd like to assemble them.
$sql = "INSERT INTO archive (idDocument,documentNumber,submissionDate,projectName)
SELECT idDocument,documentNumber,submissionDate,projectName
FROM projects
WHERE id='".$id."'";
$sql = "DELETE FROM projects
WHERE id='".$id."'";
1/ First of all, how can I assemble these two requests? I keep getting syntax errors.
2/ Now, I assign projects a status (in a column named status
) from "1" to "3" in PHP and I'd like to archive these projects two months after they have reached status "3". How can I do so?
Thank you very much for your help.