This would be MUCH MUCH easier to do if this data were in a database instead
of a flat file. But, to accomplish this you need to write some code using
the various array functions in PHP, such as asort() and explode(), and
structures such as for() and each() to eliminate the array rows that don't
match your criteria.

"PHP and MySQL Web Development" by Luke Welling and Laura Thomson is a great
book for learning PHP (it's what I used). There's not a whole chapter on
file functions in PHP, but, there is enough info in there to do all the
basic functions you would need to accomplish this task.

Monty


> From: [EMAIL PROTECTED]
> Reply-To: Richard Kurth <[EMAIL PROTECTED]>
> Newsgroups: php.general
> Date: Wed, 17 Jul 2002 12:52:00 -0700
> To: php-general <[EMAIL PROTECTED]>
> Subject: sorting and searching an Array
> 
> After I read this file into an array (small sample of file below) I need to
> sorted it by the name at
> the end of each line and then echo out only the ones that the name
> equals the name in a search variable.
> 
> Also could somebody recommend a PHP book that covers a lot of info on
> working with text files. It seams to be very little info in any of the
> boos I have now. It is sort of skipped over a lot
> 
> [EMAIL PROTECTED]   mrgouldian
> [EMAIL PROTECTED]   myname
> [EMAIL PROTECTED] mrgouldian
> [EMAIL PROTECTED] mrgouldian
> [EMAIL PROTECTED]   myname
> [EMAIL PROTECTED] mrgouldian
> [EMAIL PROTECTED]   myname
> [EMAIL PROTECTED]   myname
> [EMAIL PROTECTED] mrgouldian
> [EMAIL PROTECTED]   myname
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to