|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
User input --> product recommendation
I'm designing a site for a pilates instructor friend of mine. It's my first site so I'm learning a lot on the fly. So far this little project has taught me a usable amount of HTML, CSS, PHP, mySQL and JavaScript, so those are the tools I have at my disposal. What I want to do is set up a page that gives the visitor a series of questions with selectable answers (stuff like "Describe your fitness level: Out of shape, exercise occasionally, exercise regularly", etc) and based on the responses give a recommendation for what class they should register for. I'm not sure how best to go about it though. My initial thought was to create a SQL table (so Class A would have attribute "fitness" as "exercise regularly" if it was right for someone who exercised regularly) and then based on the visitor's input run a query that grabbed any class that met all of their answers. I ran into the problem that I wasn't sure how to handle it if a given class was applicable to more than one answer for a given question. I then considered programing methods for a PHP script, but nothing particularly elegant jumped out at me.
Anyway, I'm rambling now and I think I've described the problem well enough, any suggestions on methods would be greatly appreciated. |
|
#2
|
||||
|
||||
|
Making your first site for someone other than yourself.... oy!
Anyway... I'd use a comma or semi-colon separated list of values. Then you can do something like this: Code:
$key = 'exercise regularly';
// RLIKE is case-insensitive by default
$result = mysql_query('SELECT count(id) FROM blog_post_table '.
' WHERE category_tags RLIKE \'(^|,)'.$key.'(,|$)\'');
Since this is a server-side issue... ** Moved to MySQL Forum **
__________________
Spreading knowledge, one newbie at a time. Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Dynamic Site Solutions Design/program for Firefox (and/or Opera), apply fixes for IE, not the other way around. I'm looking for new clients. |
|
#3
|
|||
|
|||
|
Quote:
It's actually easier than I thought it was going to be. The hardest parts were designing the interfaces she would use on her end to interact with the site (edit her schedule, choose which client testimonials show up on the site, etc). In any event she's easily impressed and I need to build a portfolio if I'm ever going to get paid for this type of work, so it was a win-win arrangement. Thanks for the advice, it looks like it will do nicely. I'll be sure to put the site up on the critique forum when I finish it so I can learn as much from the experience as possible. |
![]() |
| Viewing: Dev Shed Forums > Databases > MySQL Help > User input --> product recommendation |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|