Difficulty setting a "changing" variable.
Posted: Sun Apr 11, 2010 4:19 pm
Hi all -
Here is my current block of code:
Basically, I'm taking a text file which is full of customer order information, with the first field being the invoice number. In the text file, if a customer has ordered more than one item, the subsequent order information only has a "+" for the invoice number, rather than the invoice number itself. So I'm trying to step through the data, and if a "+" is found, then use the previous (correct, or stored) invoice number.
However, I can't seem to get this to happen - all my data is then written with the "+" and not the actual invoice number.
Any help would be TREMENDOUSLY appreciated. I hope I've explained this clearly.
(edited: took out code comments)
Virginia
Here is my current block of code:
Code: Select all
do {
$customerData=fgets($handleReadCA);
$temp=explode("\t",$customerData);
$invoiceNum=$temp[0];
if($temp[0]=="+") { $temp[0] = $invoiceNum; }
else { $invoiceNum = $temp[0]; }
$value=implode("\t",$temp);
fputs($handleWriteCA, $value);
} while(!feof($handleReadCA));However, I can't seem to get this to happen - all my data is then written with the "+" and not the actual invoice number.
Any help would be TREMENDOUSLY appreciated. I hope I've explained this clearly.
(edited: took out code comments)
Virginia