Re: Searching a MYSQL DB

From: Date: Wed, 23 May 2001 10:09:55 +0000
Subject: Re: Searching a MYSQL DB
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-54012@lists.php.net to get a copy of this message
Try this sql statement: // search for the keyword in NAME or DESCRIPION.. // using the wildcard '%'. $sql="select * from TABLE_NAME where Name='%search_query%' OR Description='%search_query%'"; $result=mysql_query($sql) or die ("blah, blah, blah"); ...more php codes...see php manual for 'mysql_query' and other functions.. [double check the syntax] //where 'search_query' is the form variable that is passwd to the script...the one the user types in the keyword. I hope that's what you were looking for.. -John __________John Monfort_________________ _+-----------------------------------+_ P E P I E D E S I G N S www.pepiedesigns.com "The world is waiting, are you ready?" -+___________________________________+- On Wed, 23 May 2001, YoBro wrote: > Hi, > > Any ideas, or any code that will allow a search of specific keywords in a > mysql database. > > Feilds in a Table called: > Name > Description > > What I am after is if somebody types the word 'hammer', then I want it to > return the results in a list if the word hammer is picked up under the name > of description feilds. > > Is this easier enough to do? > > YoBro > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.general (#54012) next »