[thelist] CSV+PHP
Jay Blanchard
jay.blanchard at niicommunications.com
Mon Aug 19 10:45:00 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]
Into a table (database?)? or an array? If it is in a table then you can
issue an SQL query. If not you are going to have to loop through your array
and check the values each time. (pseudo-code)
for($i=1, $i<$number_of_rows, $i++){
if($csv_row == $search_term){
print($csv_row);
exit();
}
}
HTH!
Jay
I have PLENTY of talent and vision. I just dont care.
***********************************************************
* 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