I have the following code, to set an array with the current batch_id numbers
<?php
$select = mysql_query("SELECT * FROM send_batch") or die(mysql_error());
$i = 0;
while($row = mysql_fetch_array($select)) {
if(key($row) == 'queue_id') {
$batch_id = $row['batch_id'];
$new_id[] = $batch_id;
$sql = mysql_query("UPDATE send_batch SET process='sending' WHERE batch_id = '{$new_id[$i]}'") or die(mysql_error());
$i++;
}
}
?>
What I can't figure out is how to take that and delete records with the exact same queue_id numbers from a different table.
Basically, inserting them into the 'send_batch' table, sending off the emails, and then deleting them from the 'send_queue' table.
Here's what I'm trying to accomplish:
1. duplicate table 'subscribers' into table 'send_queue'
2. select 25 records from 'send_queue' and insert into table 'send_batch'
3. lock 'send_batch' so there's no crashes during loops
4. // send email
5. unlock 'send_batch'
6. delete * from 'send_batch'
7. delete the 25 records from 'send_queue'