![]() |
|
#1
|
|||
|
|||
database searchi just know 1 text box database search, can anyone help for many text boxes database search?
for example, i can key in name in text box, check box and list box, and then press the search button to search from database. the scripts below are just search from 1 text box only... can someone teach me for multiple search? thank you.. PHP Code:
PHP Code:
PHP Code:
http://img.photobucket.com/albums/v2...oon/search.jpg Last edited by JdS : 19-Aug-2004 at 05:58.
Reason: Please insert your example PHP codes between [php] and [/php] tags
|
|
#2
|
||||
|
||||
|
Hmmm, I was really stumped for awhile, when I first read this post, but maybe it was because I had just got out of the hospital and was still under the effects of the sedation. (don't worry folks! nothing too serious! Just a had to go thru a little test!)
Now I seem to read this post in a whole new light!!! In fact, I just figured out a GREAT way of doing this that I might even implement in my own code! In order to conduct the search from "several" fields in your form, you're going to have to get those multiple $_POST variables together - lets concactentate them, and seperate them with a space: PHP Code:
Next.... Lets explode this $search_string into an array: PHP Code:
Now lets create our query string. We're going to use the power of REGEXP and some MySQL magic here. We're basically going to be searching for words in the MySQL database. In fact, I decided to just go ahead and write you a complete function: Here's the code to call the function, including some of the code mentioned above: PHP Code:
Here is our create_find_words_mysql_query function... tested.... I even added it to my own library of functions at my site. I love this thing!!! You'll love it too! PHP Code:
I hope this answers your question and helps you out a bit.... enjoy. |
|
#3
|
|||
|
|||
|
wah!!!
very complicated code, nice.... but i'm not very understand.... it's ok for me to do the text box searching, but i don't know how to do the age & check box searching... |
|
#4
|
||||
|
||||
|
Ok, I've looked at your form. Give me a little time and I'll come up with an eloquent solution to your problem here... you still need it solved, right?
|
|
#5
|
|||
|
|||
|
thanks......
|
|
#6
|
|||
|
|||
|
i've tried this way, but dunno how to show the age and the checkbox..
i have 2 list menus, named lowage & highage in search.php, i want to find the age between 2 list menu... i don't store the age into database, i use current year to minus year of birth of someone, when i do searching, i can't use ("select age from `table` where age >= '$lowage' and age <= '$highage'"); how to solve it??? thanks... PHP Code:
|
|
#7
|
|||
|
|||
Re: database searchI firsly I apollogize my bad english I maked cv a web pages but I can not searching multiple criterias I saw your php codes in up may you can help me I maked this web pages on my localhost and my database is ararat and cv tables name is ararat_cv
and criterias are -city -male or female -age -interested occupation can you hepl me please I mnot good programer please |
Recent GIDBlog
NARMY by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Read a .html file, check that file for links | salemite | C Programming Language | 10 | 17-Jan-2008 07:56 |
| Multiple Database search | misunderstood | MySQL / PHP Forum | 11 | 04-Jun-2004 12:21 |
| How a search engine really works (In english) | jrobbio | Open Discussion Forum | 0 | 06-Jul-2003 17:13 |
| Search Engine Positioning 101 and 201 "How To" Tips... | 000 | Search Engine Optimization Forum | 0 | 29-May-2003 10:34 |
| [class] 404 search function code | jrobbio | MySQL / PHP Forum | 6 | 22-Apr-2003 09:32 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The