Page 1 of 1

Using .csv file to populate an array?

Posted: Sat Jan 17, 2009 12:38 am
by otherslost
This is my first post here & hopefully it's not a stupid one.

I have a mysql db that takes data from a c-shell script and I built a web interface to access the data in a very clean manner. Everything works how it's supposed to and the layout is exactly what I was after.

Now I want to be able to pass multiple search terms to the page and have it find and display all the entries on one page.

I was thinking that I would need to upload the text/csv file to the server then parse each line of the file and put them into an array that I can then write a foreach loop to find all of the entries I am searching for.

I have anywhere from 50-100+ items to search for at a time and it would be great to have a way that I can automate the process without having to input each search term individually.

Does anyone have any ideas how I should go about doing this?

Thanks in advance for any help anone can offer.

Re: Using .csv file to populate an array?

Posted: Sat Jan 17, 2009 9:46 am
by Burrito
fgetcsv() is going to be your easiest solution.

Just add items to your array on each iteration of the loop.