Re: [PHP] Searching a mySQL DB
At 4:06 AM -0700 15/4/02, Thomas Edison Jr. wrote: >I have a table with a column vProName, which >let's say, contains a record "Basket Ball Game". >Now what i want is that if someone searches for "Game" >or "Ball", even then this record should appear. Either "select * from ThatTable where vProName like '%Game%'" or for better performance and result ranking: http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html#Fulltext_Search ...R. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Searching a mySQL DB
Check out the MySQL page at http://www.mysql.com/doc/F/u/Fulltext_Search.html. This page talks about doing full-text searches through your data. Then you can implement the queries using PHP scripts to perform the searches.. It works super smooth.. You do have to create an index of any column you want to be able to search but phpMyAdmin will do it for you if you are not familiar with how to do it. Later, Bob Weaver "Thomas Edison Jr." <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I'm working on a search program that searches on a > mySQL DB and gives back results. > > I have a table with a column vProName, which > let's say, contains a record "Basket Ball Game". > Now what i want is that if someone searches for "Game" > or "Ball", even then this record should appear. > > Could someone guide me for the same > > Thanks, > T. Edison Jr. > > > __ > Do You Yahoo!? > Yahoo! Tax Center - online filing with TurboTax > http://taxes.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Searching a mySQL DB
I'm working on a search program that searches on a mySQL DB and gives back results. I have a table with a column vProName, which let's say, contains a record "Basket Ball Game". Now what i want is that if someone searches for "Game" or "Ball", even then this record should appear. Could someone guide me for the same Thanks, T. Edison Jr. __ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Searching a MYSQL DB
Yes, it's easy and you already have at least one answer. If you are going to be doing any database programming, a basic familiarity with SQL (Structured Query Language) and relational databases is pretty essential. A book like "SQL for Dummies" is an excellent place to start, you could probably find some useful things on line if you search for something like "SQL tutorial". There may also be a tutorial linked from the MySQL web site. So, dig in and have fun. It's pretty straightforward. Regards - Miles Thompson At 09:44 PM 5/23/01 +1200, 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: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] >To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Searching a MYSQL DB
Hey, Simple solution: " . stripslashes(htmlentities($name)) . "\n\n" . stripslashes(htmlentities($description)) . "\n"; } ?> James. ""YoBro"" <[EMAIL PROTECTED]> wrote in message 9eg0jl$5ac$[EMAIL PROTECTED]">news:9eg0jl$5ac$[EMAIL PROTECTED]... > 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: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Searching a MYSQL DB
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: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Searching a MYSQL DB
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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]