PDA

View Full Version : Tutorial Search: mySQL Filtering



camargo
January 2nd, 2007, 06:42 PM
Hi Kirupans,

Happy New Year to everyone. I'm trying to look for a tutorial that will allow me to filter my entire product catalog in a mySQL database. All of the products are already there and my database has been structured, but I'm looking for a way to have a page that spits out ALL of the products at once, then build in a form that lets my users select the features they're looking for, and narrow down their selection (live using AJAX if possible, but not necessary).

If you know of a tutorial or a set of tutorials that would come in handy, or would like to lend me some guidance, let me know! Much obliged!

bwh2
January 2nd, 2007, 07:09 PM
i would start here: http://w3schools.com/sql/sql_where.asp

i have a SQL Joins tutorial in the works, which could also help. look for it as early as next monday.

camargo
January 3rd, 2007, 03:34 PM
Hey Brian,

Thanks for the link. I think I've got a good grip on how to write the SQL queries (again, I think), but what I'm really looking for is information on how to write the PHP/Javascript to modify the SQL query as the user makes their selections.

camargo
January 7th, 2007, 01:14 PM
Anyone?

nobody
January 7th, 2007, 02:29 PM
I'm just going to post some conceptual stuff, no code. An easy way to do what you want is to have a template query, something like "SELECT * FROM $table SORT BY $sortMethod $direction"

And then you have drop downs or whatever that would set the $table variable, the $sortMethod (i.e. date, id, etc) and then something to selecect ascending or descending.

Not sure if this is what you're looking for or not, but you can load up your query with variables, so all you need to figure out is how to get the variables you want to where you want them.