Page 1 of 1

Beginner looking for advice creating a multi variable search

Posted: Wed Jun 11, 2008 2:36 pm
by Snot
Greetings

I am trying to get a search able database for my site I hope I am posting this in the right place, if not please feel free to more or delete it and I'll know that I was wrong. Well this is my project I have been trying deferent search engines from here for my Tarantula website and I haven't really come up with anything pre made for the search function it just needs to allow users search by all or any of these options.

1. Scientific Names = genus + species-----------------Will be added over time
2. Genus = 100+ different tarantulas------------------Can be added upfront but may need to change or add to over time
3. Species = 800+ different species-------------------Will be added over time
4. color = The most common colors---------------------Will be added over time
5. Gender = Male, Female------------------------------Fixed
6. Humidity = Low 50% to 60%, Medium 60% to 70%, High 70% to 85%-----------Fixed
7. Speed = Slow, Medium, Fast-------------------------Fixed
8. Temperature = Cool 50°F to 80°F, Warm 60°F to 90°F, Hot 75°F to 90°F----Fixed
9. Max Size = 1" to 3", 4" to 6", 7" to 8, 9"+--------Fixed
10. Location = New World, Old World-------------------Fixed
11. Housing = Arboreal, Terrestrial, Fossorial--------Fixed

There are 800+ different types of Tarantulas and 99% of the time, you decided you want a big one or a small one or a blue one or a extra harry one before you find out what Tarantulas actually have those traits. I would like my site to be a place where you can search for blue and find all the Tarantulas that are tagged as blue. You could mix and match and search to find all the blue Tarantulas that are Old World and so on.

I also need a system that will allow users to submit Tarantulas to my website using their scientific names along with any other information or pictures they have. There also must be a way for me/admin to approve/deny/edit all the submission before they are posted into the site or made search able. So there will need to be some type of admin login panel that will allow me/admin to be the only ones able to approve/deny/edit the submission.

There must also be some way to upload images and data about the Tarantulas that are already existing in the site. I also need to be able to have a good looking results page.


Well you've got to start some where right? Grin Please forgive me for the following vague questions but being a beginner its really be a challenge to explain everything I need the search function to do.

I would really appreciate it if you guys would be so kind as to help me figure out what sets of code/database or program will allow me to accomplish this?

My most important question is how a beginner should go about starting a project like this?

I was advised to check out regex, php, mysql, and ASP (I think it only works on windows server and mine is on a Linux) Huh

This is a link to my site. The only thing I care to keep is the design the form's not connected to anything and for all I know I'll never need them but I made them just to give myself an idea of what I thought it would look like.

http://www.tarantuladatabase.com/assets ... earch.html

Thank you all so much for trying to get me started on the right path.

Re: Beginner looking for advice creating a multi variable search

Posted: Wed Jun 11, 2008 3:00 pm
by deejay
Hi


If your looking at building the code yourself, it'sparobably not as difficult as you may think it is looking at other peoples code. and you'll understand it much better when you come round to making changes at a later date.
I would start by working out the structure of your database, the queries on your database will be doing all the work for you.
Personally I use $_GET to send what search I want to do and what I want to search, which is then picked up on the same page.
You'll also want to use pagination ( so that you don't have too many results on the same page, easier to use etc,) you can do a search for that on this forum or google.

Hope that helps - theres far to much to explain in one post but seek and you will find :)

Re: Beginner looking for advice creating a multi variable search

Posted: Wed Jun 11, 2008 7:44 pm
by Snot
Thanks so much for the help

http://www.tarantuladatabase.com/assets/pages/test.html

This is kinda what I have been playing around with for php If this is working I can see how it works a little.

I haven't been able to get connected to the database I did find phpmyadmin. I made a table with 1 feild but I don't understand what format I need to use.

Will i have 1 table for each spider or will i have 1 table called Tarantula with 1 field called Housing and so one like this.

Code: Select all

 
Table called Tarantula
 
>Housing
>>>>>>>>Arboreal
>>>>>>>>Terrestrial
>>>>>>>>Fossorial
>Location
>>>>>>>>New World
>>>>>>>>Old World
>Speed
>>>>>>>>Slow
>>>>>>>>Medium
>>>>>>>>Fast
 
 
Is this right at all?
I am confused about the things that I dont know like genes species and color.

Re: Beginner looking for advice creating a multi variable search

Posted: Wed Jun 11, 2008 9:26 pm
by superdezign
When you have a limited amount of possible values, it is a good idea to normalize that into another table in your database, and access it via its primary key.

i.e.

Code: Select all

Table `gender`
ID | Gender
---+-------
0  | Male
1  | Female
 
Table `speed`
ID | Speed
---+-------
0  | Slow
1  | Medium
2  | Fast
 
Table `spiders`
ID | Name | Gender | Speed
---+------+--------+------
0  | Blah | 0      | 1
1  | Yada | 1      | 2
2  | Fooo | 0      | 0
So 'Blah' would be a medium-speed male, 'Yada' would be a fast female, and 'Fooo' would be a slow male. This way, you can use dropdowns and selection lists to allows users to select one of the valid values, then search the database for entries with that same attribute id. You could populate these dropdowns using your database as well, to allow all of the editing to be done through some sort of administrative system to avoid reprogramming anything, and you can always add more types of values into the database.

Re: Beginner looking for advice creating a multi variable search

Posted: Thu Jun 12, 2008 11:07 am
by Snot
I think i got the hang of how to create the table... I think

This is my table

http://www.tarantuladatabase.com/table.JPG

and these are the values

http://www.tarantuladatabase.com/value.JPG

I couldn't figure out how to leave a field value black so I just put None in as a place holder.

How does that look?

Re: Beginner looking for advice creating a multi variable search

Posted: Thu Jun 12, 2008 1:02 pm
by Snot
never mind I fixed the id thing and got rid of the search all and none values.

http://www.tarantuladatabase.com/gotit.JPG

now i guess i'll try and connect it to the database *Gulp*

unless you guys have any advice?