|
Posted by Tyrone Slothrop on 12/10/06 16:12
On Sun, 10 Dec 2006 12:58:08 +0100, "H@C0" <name@fish.net> wrote:
>One more question ...
>How can I count the results?
>I want each line of the results to start with a count number.
>TIA,
>Hans
>
>>>
>>>Something like this will display all records containing "London"
>>>
>>>$search="London";
>>>
>>>$data=file("data.txt");
>>>
>>>foreach ($data as $row){
>>> $field=explode("||",$row);
>>> if(strpos($field[0],$search)!==false){
>>> echo $row,"<br>";
>>> }
>>>unset($field);
>>>}
Before the search:
$i=1;
Then:
echo $i++.". ".$row."<br>";
I coded a flatfile database script a couple weeks ago with a lot of
nice features, like multi-page results (1-10>>11-20, etc.), search for
a range value in an integer field, and a lot more. You may have the
script in its present form (beta with a couple little bugs) if you can
provide a place to send a zip file. Just post a message here with
subject of Attn: Tyrone Slothrop
(No, that is not my real name.)
All I ask in return is a report of any bugs you find in the script
since it will be going into a production environment in a week or two.
[Back to original message]
|