Thanks much, I assume I can add a WHERE in the first line?
I neglected to tell you I have to do chunks at a time (based on id). I only ask before trying because this is a live database.
EXAMPLE:
$q = "SELECT MAX(id) AS id FROM archive_table WHERE id = '$variable_here'";