[thelist] CSV+PHP

Mark Joslyn Mark.Joslyn at SolimarSystems.com
Mon Aug 19 10:35:00 CDT 2002


Good Day List-Goers!!

I have a bit of a problem I cannot seem to solve.

I have a CSV (text) file that essentially has three column (Customer Name,
Model Number, Price)

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.

I can't seem to query the CSV file with any success. I use php.net's
"display all records in a CSV file" code as it pertains to fgetcsv function
for a starting point. I try to tweak that to get my desired results, but I
cannot figure out how to access single records in a CSV file!

Any help would be appreciated.

Thanks,

markJ





More information about the thelist mailing list