[thelist] CSV+PHP, MORE
Jay Blanchard
jay.blanchard at niicommunications.com
Mon Aug 19 11:33:01 CDT 2002
[snip]
I can get the CSV file to read in (fgetcsv) and print it's entire contents
into a table, however, I want it only to print out the record that matches a
variable set in a preceeding form.
So, when a custmer enters model # ABC, I want PHP to run through the
contents of the CSV file (300 records) and search for the row that contains
model # ABC. If found, only that row will print.
[/snip]
http://www.php.net/manual/en/function.in-array.php
Just ran across this when consulting the manual for something else. From the
PHP manual page;
in_array
(PHP 4 )
in_array -- Return TRUE if a value exists in an array
Description
bool in_array ( mixed needle, array haystack [, bool strict])
Searches haystack for needle and returns TRUE if it is found in the array,
FALSE otherwise.
If the third parameter strict is set to TRUE then the in_array() function
will also check the types of the needle in the haystack.
Note: If needle is a string, the comparison is done in a case-sensitive
manner.
Note: In PHP versions before 4.2.0 needle was not allowed to be an array.
HTH!
Jay
I do whatever my rice crispies tell me to
***********************************************************
* Texas PHP Developers Conf Spring 2003 *
* T Bar M Resort & Conference Center *
* New Braunfels, Texas *
* San Antonio Area PHP Developers Group *
* Interested? Contact jay.blanchard at niicommunications.com *
***********************************************************
More information about the thelist
mailing list