Creating a report from a text file. But got a problem with it showing 2 results per SMS. Want 1 report/ SMS

From: J (no_at_email.com)
Date: 02/28/05


Date: Mon, 28 Feb 2005 20:51:21 GMT

Hi All

I have this working but it gives 2 outputs per number, I would just want it
to give 1 output, but change as the delivery status changes (from 003 to
004)

I have a text file with this isn:
--------------------- text file ---------------------------
[STATUS]<del>003<del>1109621666<del>447887842666<del>447849194666<del>1.500000<del>c8e8a994ec375a99b6e0c5bb24e666ca<del>
[STATUS]<del>004<del>1109621666<del>447887842666<del>447849194666<del>1.500000<del>c8e8a994ec375a99b6e0c5bb24e666ca<del>
[STATUS]<del>003<del>1109623333<del>447887845333<del>447849194333<del>1.500000<del>c8e8a994ec375a99b6e0c5bb24e333ca<del>
[STATUS]<del>004<del>1109624333<del>447887845333<del>447849194333<del>1.500000<del>c8e8a994ec375a99b6e0c5bb24e333ca<del>
[STATUS]<del>003<del>1109621617<del>447887842111<del>447849191111<del>1.500000<del>c8e8a994ec375a99b6e0c5bb24e111ca<del>
[STATUS]<del>004<del>1109621624<del>447887842111<del>447849191111<del>1.500000<del>c8e8a994ec375a99b6e0c5bb24e111ca<del>
-----------------------------------------------------------------

The end ID is always different, its an ID for a text message that is sent.
003 at the beginning = delivered to SMS server
004 " " = Delivered to Mobile phone.

I want the report to read something like:
(but it shows every line, so 2 reports per sms, not one report per sms)

----------- Report ---------------------
Number sent to: 447887841666 | sent from: 447849194666
Used: 1.5 Credits | Status: Delivered to Phone

Number sent to: 447887841333 | sent from: 447849194333
Used: 1.5 Credits | Status: Delivered to SMS server (If not delivered to
phone yet)

Number sent to: 447887841111 | sent from: 447849194111
Used: 1.5 Credits | Status: Delivered to Phone
----------------------------------------

--------- Script--------------
$file = file("status.txt");

echo "<table border=0 id=table2 align=center><tr>";

// Get amount of lines in file
$totalLines = sizeof($file);
// Loop through and display all users
for($line = 0; $line < $totalLines; $line++){
$string="";
$formdate = date("d-m-y H:i:s", $timedate +5);
    // Dont print out lines beginning with a comment
    if("//" != substr($file[$line], 0, 2)){
        // Put contents of line into variables
        @list($nothing1, $status, $timedate, $to, $from, $creditused, $id) =
explode("<del>", $file[$line]);

        $string .= "<tr><td><font face=verdana size=2>Message to: <input
readOnly value=\"$to\" name=to id=to size=15></td>";
        $string .= "<td>From<input readOnly value=\"$from\" name=from
id=from size=15></td>";
        $string .= "<td>Used: ". $creditused. " credits</a></td></tr>";
        $string .= "<td>Time: $formdate Status: ";

        if ($status == 003){
         $string .= "Delivered to SMS server<br>";
         }
        if ($status == 004){
         $string .= "Delivered to Phone<br>";
         }
        " credits</a></td></tr>";

        echo $string;
    }
}
?>
</tr>
</table>
--------------------------------------

Any ideas?
Thanks all,
J