Hello there!
But its not like I have tried myself! Been thinking about this little problem for a week now… Sleepless nights sleepless days to for that matter.
I am not yet very skilled in PHP, so I maybe dont see the problem for the same view as experienced PHPers.
Annyway. I am making a website about the popular MMORPG Ultime Online, and my ambition is to create a guild database, and a pretty comples search option for it aswell, using PHP and MYSQL.
All guilds that are signed into the database enter a number of parameters. There are 5 of them. For instance there are a parameter if the guild is a roleplaying guild, and there is also one if the guild do war with other guilds, or is peacfull as a peacfull lamb. These parameters are all written in to the database, and displayed on sub-site to my main Ultima site.
The thing is, I want people to be able to use html check boxes, to define what guilds they want to be displayed. For example, lets say that someone checks ”Roleplaying” and ”Waring”, I want just guilds with those parameters to be displayed.
In my case, the parameter collums are mostly built with ”no” and ”yes” answers. A roleplaying guild has ”RP” in its roleplaying row, as its true. If it would not be true it would be ”None-RP” instead.
A peacfull guild has ”Peacfully” if its peacfully, else its ”Waring”. The parameter Evil/good aligned has ”Evil” or ”Good” answers in its row.
Ofcourse, I could have used just 0 and 1 to define if its true or not, however as the infos should be displayed aswell, this could be done (i think..eh)
All those parameters are set and sent to the MySQL when the guild register at the register page.
Now, lets talk about the search script. As I said earlyer, I want users that are browsing the guild database, to be able to choose what guilds they want the page to display.
If Bob the Ugly, wants only to view guilds that fits him, then he will be able to do so. Lets say that he just want to look at waring, evil and roleplaying guilds. Then he should be able to check ”Waring”, ”Evil” and ”Roleplaying” using either checkboxes or radiobuttons, submit the search, and then only guilds with those requirements will show up.
I know how to use the MYSQL where and having thingys, but I cant understand how this can be done.
I belive there is a simple answer to this. Would be thankfull if someone could explain it to me, or maybe give me some links to pages explaining it.
I mean, how should the sql_query now IF the boxes/variables have been checked/defined?
Thanks.