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

x
?
Solved

Multiple filtering with PHP

Posted on 2005-03-19
2
Medium Priority
?
216 Views
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
0
Comment
Question by:hasozduru
2 Comments
 
LVL 11

Accepted Solution

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

eg,

They select PDAs:
SELECT * FROM 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

etc...

that would be the simplest method :)
0
 

Author Comment

by:hasozduru
ID: 13829700
Hi Neester

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

Thanks
0

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