Page 1 of 1

advanced filtering

Posted: Tue Jan 01, 2008 3:50 pm
by yshaf13
Hi, Does anybody know of a script I can use for advanced filtering? I need to be able to filter by four or five different things or none at all or only some, and on top of that there has to be ordering.... It's a lot of work and I was just wondering if I can reuse someone's code since it's a pretty basic function of database driven sites...

Posted: Tue Jan 01, 2008 3:58 pm
by Christopher
What are you filtering?

re

Posted: Tue Jan 01, 2008 4:08 pm
by yshaf13
i have kids in a camp.
I want to be able to filter by group, gender, age, incomplete profile, tests scores....
and after that i have to be able to order by name, group, .....

Posted: Tue Jan 01, 2008 4:30 pm
by Kieran Huggins
SQL is all about filtering results - that's the language you want to learn.

Re:

Posted: Tue Jan 01, 2008 5:31 pm
by yshaf13
sorry for not being more specific. I know basic SQL and could probably write it up myself, but it's pretty tedious to write the code so that it looks through all the filtering data collected from the form and generate SQL based on that. I just thought maybe there is a code snippet out there somewhere that i could just reuse...

Posted: Tue Jan 01, 2008 6:51 pm
by Kieran Huggins
ah - what you're looking for is an ORM: "Object Relational Mapping"

Propel and Doctrine are the "big two", but there's a more exhaustive list here:
http://en.wikipedia.org/wiki/List_of_ob ... ftware#PHP

Posted: Tue Jan 01, 2008 6:52 pm
by Christopher
So for all the smart, jerky young boys whose parents fill out forms completely:

Code: Select all

SELECT * FROM kids WHERE group='brats' AND gender='M' AND age<10 AND incomplete_profile='No' AND test_scores>90

re

Posted: Sun Jan 06, 2008 5:29 am
by yshaf13
if you would like to see exactly what i need, go to kayak.com, do a search for anything and check out the filtering on the left side. i dont need all the fancy javascript, just the filtering....

Posted: Sun Jan 06, 2008 5:51 am
by Kieran Huggins
They're showing and hiding results with javascript - I would assign each result a custom DOM attribute like "airline='xxx'" and select the node to hide/ show based on that. jQuery would make exceptionally short work of that.