Odd recordset results
I know this is kind of outside the WebAssist ext but hoping you could help me. I had this code working with the old version but after the recordset was changed it broke so I recreated a fake area I wanted repeated and wrapped it around this code. It basically writes the results returned to a csv file, but for some reason it writes the same record over and over:
<?php
$fp = fopen($fileName, "w");
fwrite($fp,"Pub Name,Advertiser,Title,Insert Date,Our IO #,Your ID #,Check Num,Completed?,Canceled,Cost\n");
$wa_startindex = 0;
while(!$rsRESULTS->atEnd()) {
$wa_startindex = $rsRESULTS->Index;
$job_orderID = $rsEXPORT->getColumnVal('orderID');
$job_date = $rsEXPORT->getColumnVal('start_date');
$job_media_cost = $rsEXPORT->getColumnVal('media_cost');
$job_company = $rsEXPORT->getColumnVal('company');
$job_pub_name = $rsEXPORT->getColumnVal('pub_name');
$job_job_title = $rsEXPORT->getColumnVal('job_title');
$job_start_date = $rsEXPORT->getColumnVal('start_date');
$job_invoiceNUM = $rsEXPORT->getColumnVal('invoiceNUM');
if ($rsEXPORT->getColumnVal('pub_inv_num') != "0") {
$job_pub_inv_num = $rsEXPORT->getColumnVal('pub_inv_num');
} else {
$job_pub_inv_num = "";
}
if ($rsEXPORT->getColumnVal('rs_check_num') != "0") {
$job_rs_check_num = $rsEXPORT->getColumnVal('rs_check_num');
} else {
$job_rs_check_num = "";
}
if ($rsEXPORT->getColumnVal('complete') == "0") {
$job_complete = "NO";
} else {
$job_complete = "YES";
}
if ($rsEXPORT->getColumnVal('killed') == "0") {
$job_killed = " ";
} else {
$job_killed = "YES";
}
if ($rsEXPORT->getColumnVal('mailed') != "0") {
$job_mailed = $rsEXPORT->getColumnVal('mailed');
} else {
$job_mailed = " ";
}
$job_company = preg_replace("/,/", "", $job_company);
$job_job_title = preg_replace("/,/", "", $job_job_title);
$job_pub_name = preg_replace("/,/", "", $job_pub_name);
fwrite($fp, "$job_pub_name,$job_company,$job_job_title,$job_date,$job_orderID,$job_pub_inv_num,$job_rs_check_num,$job_complete,$job_killed,$job_media_cost,$job_mailed,$job_invoiceNUM,\n");
$rsRESULTS->moveNext();
}
$rsRESULTS->moveFirst(); //return RS to first record
unset($wa_startindex);
unset($wa_repeatcount);
fclose($fp); ?>