Click to See Complete Forum and Search --> : a search script


chadypu
11-15-2003, 07:54 PM
how could i go about searching a database for some stuff based on a value of a form...

i just wanna know the basics on how i could go about doing a search script

then i will expand on that and make it much more complex... just where do i start

like how can i search for a certain word or phrase in a database

hope im making sense
-chady

Khalid Ali
11-16-2003, 07:54 AM
here are the steps you need to take.

1. Get values from the form into php.

2. Creae a connecion to the mysql.
3. Point to the database where search needs to be performed.
4. create a query statement such as

"SELECT * FROM user_data WHERE user_id='112244'";

now the above statment when run, will give you search results if any available.

pyro
11-16-2003, 09:11 AM
You could also use a fuzzy search, with LIKE:

"SELECT * FROM `user_data` WHERE `user_id` LIKE '11%'"; # grabs everything's user_id that starts with 11

chadypu
11-16-2003, 11:25 AM
fuzzy search is just what i wanted

thanks pyro

pyro
11-16-2003, 12:40 PM
You bet... :)