Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Multiple filtering with PHP

Posted on 2005-03-19
Medium Priority
Last Modified: 2006-11-17
Hello Experts!

I have an online shopping site. I am selling electronic products like PDAs and Mobiles etc... I would like to write a code so customers at the first place can filter PDA's results according to operating system. Let say there are 30 PDAs that has 400Mhz CPU. After that, there should be other filter option that customer can select memory. Let say customer selected 256MB memory and there are 14 PDAs. At the last step, customer will be able to select PDAs between price £ 150 and £ 250. In the end, customer will have, for instance, 6 PDAs and he will see those 6 PDAs has 400Mhz CPU, 256MB memory and it's between £ 150 and £ 250 so those PDAs will be suitable for that customer. What is the best way of creating structure of that logic with PHP and MySQL. I can give you an example site that does it so you can understand better. http://dealtime.co.uk/xPP-Personal_Organisers . Please filter some brands or prices to see how the logic works.

Kind regards
Question by:hasozduru
LVL 11

Accepted Solution

neester earned 1500 total points
ID: 13584496
Well, at every step where the user selects a filter, add another option to your QUERY.


They select PDAs:

They select CPU = 400mhz

the query now is:
SELECT * FROM pdas WHERE pdas.cpu = 400

if they now select 128mb ram and expandable storage

SELECT * FROM pdas WHERE pdas.cpu=400 AND pdas.ram=128 AND pdas.ram_expandable=1


that would be the simplest method :)

Author Comment

ID: 13829700
Hi Neester

Could you please give me an example by writing a simple code?


Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question