looking for php to create two table search

2 replies
Hi
I am looking for a php tutorial or code that will allow me do a two table search for something like a book

So one field as genres of books Animals, Cars, DIY etc
person selects animals and the other search box gets filled with sub genres like cats, Dogs, Rabbits etc and when some one selects rabbits and presses search they see a list of books on rabbits
I know this is possible to do but I cant find anything online

Thanks
#create #php #search #table
  • Profile picture of the author xaxo
    If i understood you right you want to get all the records from a database that are similar to the genre the user selected - here is some code, check out some php/mysql search tutorials - youtube is full of them.

    ....assuming you already get/filter the proper values........

    $search = mysql_query("SELECT * FROM table_name WHERE table_row_genres LIKE '%$value_user_checked%') or die(mysql_error());
    ..........................

    This will do a mysql query and will select everyting from the specified row that looks like $value_user_checked.
    change table_name, table_row_genres, $value_user_checked - with your corresponding data
    {{ DiscussionBoard.errors[3997087].message }}
  • Profile picture of the author ussher
    if your looking for a jquery multiple select where the contents of the second list is dependent on what is selected in the first list, this one works well.

    jQuery controlled Dependent (or Cascading) Select List « PHP for Bangladesh

    (we use it for selecting our main category and sub category on our Create Projects, Create Services, and Create Files pages here http://www.earner.net/ )
    Signature

    "Jamroom is a Profile Centric CMS system suitable as a development framework for building entire communities. Highly modular in concept. Suitable for enterprise level development teams or solo freelancers."

    - jamroom.net
    Download Jamroom free: Download
    {{ DiscussionBoard.errors[4000985].message }}

Trending Topics