Basically I have a csv file with order information on it, ordered from a website, containing invoice number, name, address, etc. I've used PHP to turn this into invoices. It looks pretty good but I'm completely stuck on one bit.
Here's the opening bit using fgetcsv;
<?PHP
$file_handle = fopen("orders.csv", "r");
while (!feof($file_handle) ) {
$csvline = fgetcsv($file_handle, 1024);
?>
In the csv file, if someone has ordered more than one item it appears on a new row with the same invoice number as the row before, but doesn't show any product in the first row of the invoice number:
100001,Bradley Manning,email1@address.com,Address,Product A,
100002,Mr Snowden,email2@address.com,Address,Product A,
100003,Dr Dre,email3@address.com,Address,,,
100003,,,,,,,,,,"Product A",
100003,,,,,,,,,,"Product B",
100003,,,,,,,,,"Product C",
The PHP takes these values (eg. $csvline[0] for the invoice number) and puts them in a nice printable html file. But I need to be able to get the rows beginning with the same invoice number onto the same html table (in the cell below the first ordered product).
Any suggestions for my pretty awfully worded problem would be very much appreciated!
Ps. Here's the php / html snippet:
<?php
$exvat = ($csvline[15] / 1.2);
$exvatrounded = number_format($exvat, 2, '.', '');
?>
<div class="t2 th">Description</div>
<div class="t3 th">Unit Price</div>
<div class="t4 th">Quantity</div>
<div class="t5 th">VAT Rate</div>
<div class="t6 th">Amount</div>
<div class="even">
<div class="t2 td"><?php echo $csvline[12]; ?></div>
<div class="t3 td">£<?php echo $exvatrounded; ?></div>
<div class="t4 td"><?php echo $csvline[14]; ?></div>
<div class="t5 td"><?php echo $csvline[16]; ?></div>
<div class="t6 td">£<?php echo $csvline[20]; ?></div>
</div>
<div class="odd">
<div class="t2 td">MORE PRODUCT LINES??????????????????</div>
<div class="t3 td">£AMOUNT</div>
<div class="t4 td">QUANTITY</div>
<div class="t5 td">VAT</div>
<div class="t6 td">£TOTAL AMOUNT</div>