filtering, limiting and paginating CSV results

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kevrelland
Forum Commoner
Posts: 73
Joined: Mon Jan 08, 2007 7:41 am

filtering, limiting and paginating CSV results

Post by kevrelland »

I currently putting together a site and the data is stored in a csv file.

Can anyone give me some direction on how to limit the array that i have already got, thats working, to a specified number of records and add in the the pages for the other results.
I also want to be able to filter the results to show for example all the people with the name kevin, with a drop down menu, containing all the names of everyone in the csv.

i have loads of searches and all i can find is how to import into a mysql db or just show all the data in one go and i just don't know where to start looking

cheers
kev
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: filtering, limiting and paginating CSV results

Post by pickle »

There's no real way to paginate the data in a CSV without loading it all up. You would REALLY benefit from storing that data in a database, as you can do a few simple queries to get your pagination & your search.

What is the array you've already got? Does it contain all the CSV data? Other data the CSV data is to be appended to?
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Re: filtering, limiting and paginating CSV results

Post by anjanesh »

kevrelland wrote:i have loads of searches and all i can find is how to import into a mysql db or just show all the data in one go and i just don't know where to start looking
Look into MySQL's CSV storage engine.
You get to store data in CSV format and mysql can handle your SQL statements at the same time.
Post Reply