You don't have to execute loop for determining state of database
1) determine total number of rows in $totRowCount
2) execute following query to find whether you new tn exists in database or not.
$rd="SELECT usp_tracking_number,us_id from am_ups_shipment_package_reference WHERE US_TRANKING_NUMBER=" & $TN
if rd->$row_count=0 //tn not found insert multiple times
{
//insert rows
for 0 to $totRowCount
insert rows;
}
else //update
{
update where traking no = $tn
}
I don't know why you want to insert 4 times or n times, but i hope above algorithm will help you.
urt
|