Reply
php/mysql help
Old 05-03-2004, 09:18 AM php/mysql help
Junior Talker

Posts: 1
I am fairly new at php and need a bit of help. I am creating a website for my wife. She sells quilting fabric. I have created a database in MySQL to store my fabric data that my wife is going to enter in. She wants to enter up to 4 colors that are on the fabric so I created fields called color1, color2, color3, color4. She uses drop downlists to make it easy for her and to avoid syntax errors. If a customer wants to search for fabric with, say Blue, I know how to set up the Select/From/Where statements...but what if they want to search for fabric with blue and green? Or blue, green, yellow, etc...I am not sure how to have it search for those colors in the 4 individual color fields I have created. Do I need to restructure my database a different way? Thanks for the help every one!!

Mike
mdojet is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Old 05-03-2004, 11:04 AM
Skilled Talker

Posts: 75
Location: New Jersey, USA
Sane DB, just add 'OR' clauses to your selects...

select * from mytable where fabric = 'squares' AND (color = 'blue' OR color = 'gree' OR color='yellow');

You'll have to compose the query with more or less clauses depending on what the client is looking for.
__________________
http://www.eblush.com/
Where you can get personal, online!
eBlush_Hector is offline
Reply With Quote
View Public Profile Visit eBlush_Hector's homepage!
 
Reply     « Reply to php/mysql help
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.11294 seconds with 13 queries