I'm copying a row between two tables. Here's mah code:
$curr_po_num is the Purchase Order # of the current row, of the row that triggered the script.
Basically, I'm saying that IF the current purchase order # EQUALS the PO # of a record in the first table (new_batch), COPY that record to the second table (archive_batch)
$queryall="SELECT * FROM new_batch WHERE po_num=$curr_po_num";
$result=mysql_query($queryall) or die(mysql_error());
while($row=mysql_fetch_array($result)){
$swap="INSERT INTO archive_batch(batch_num,customername,po_num,carrier,pro_num,isNew,isShipped)
VALUES ('$row[batch_num],'$row[customername],'$row[po_num],'$row[carrier],'$row[pro_num],'$row[isNew],'$row[isShipped])";
echo "BATCH NUM: '$row[batch_num]'";
$swapresult = @mysql_query($swap);
echo "RECORD SWAPPED";
}
Now, the BATCH NUM echoes fine. I got the "Record Swapped" message just once, like I should be. I should NEVER get the message more than once, no two orders will EVER have the same PO#.
However, the row never gets created in archive_batch. The tables are identical, I figure I must either have a simple typo goof or a simple logic goof. Thoughts?