Hello
i have a script which opens a flatfile textfile, in this format
something|something
something|something
something|something
something|something
only 2 fields (but about 10 lines)
and i have a script which prints
only 2 lines of the ten (which is what i want).. so it goes through it and finds the 2 lines depending on what query is given etc..
so heres the couple of lines of code that does this.
$dbFile = "./database.txt";
$data = file($dbFile);
$total = count($data);
for ($i = 0; $i <= $total; $i++) {
$wantedLine = $i;
$lineData = $data[$wantedLine];
$lineData = explode("|", $lineData);
if($show == "2 only"){echo "
<table border=0 cellspacing=0 cellpadding=2 width=98% align=center valign=middle bgcolor=#dedede>
<tr>
<td width='70%' ALIGN='LEFT'>FILE NAME: $lineData[0]</TD>
<td width='18%' ALIGN='RIGHT'>FILE SIZE: $lineData[1]</TD>
</tr>
</table>\n"; }
}
echo "total size is: $lineData[1]";
OK 🙂
so now if you look closely i also have it printing the data from teh second field aswell ($lineData[1]) is the second field incase your not following.
everything in teh second field is numbers only.. so im trying to calculate what $lineData[1]+$lineData[1]=
and getting the $lineData[1] value from the 2 differentlines in teh database..
i know iu can easly get the entire size of all $lineData[1] fields but i dont want to do that i only need 2..
if anyone can help or suggest a way to do this Please post 🙂