Forum Moderators: coopster

Message Too Old, No Replies

Searching multiple fields and displaying results

         

Blue_Tac

5:50 pm on Aug 22, 2004 (gmt 0)

10+ Year Member



I know this is a fairly common complaint, but I have tried very hard with numerous examples posted in these forums and I'm just not competent enough to mold them to my case.

I have a table with 5 fields and I would like users to be able to use a form to search all fields in the table and then display the results on the page to the user (ie. when a search returns a hit it displays the results of all linked fields). Also it would be advantageous to have a drop down menu that populates itself based on one of the table fields so users can select from the menu rather than searching.

I realise this is common and that I have complicated it more, but any help really would very much be appreciated.

jatar_k

4:50 pm on Aug 23, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld Blue_Tac,

>> a drop down menu that populates itself based on one of the table fields

are you always searching the same table? If so you can even hard code the colnames.

issuing the SHOW COLUMNS [dev.mysql.com] query will give you what you need as well

As far as querying based on user input and looping through the returned values and displaying them on screen, this should help

Basics of extracting data from MySQL using PHP [webmasterworld.com]

Blue_Tac

7:02 pm on Aug 23, 2004 (gmt 0)

10+ Year Member



thanks there - I fixed the multiple search problem with a simple OR condition - felt very very daft when it hit me! Still struggling with the self populating drop down, but thanks for the guide, will check it out promptly.

Thanks!