Database Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesDatabase Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today!
  #1  
Old August 12th, 2003, 05:43 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
search MySQL Database

Anyone know how to do a search of a MySQL database using SELECT * FROM table_name WHERE MATCH(field_name) AGAINST(search_querry)?

Some sample code would be appriciated.

Thanks

Artoo Smith
artoo_s@hotmail.com



Reply With Quote
  #2  
Old August 12th, 2003, 05:46 PM
Blindeddie Blindeddie is offline
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: NJ - USA
Posts: 2,152 Blindeddie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 4
RE: search MySQL Database

is it single search criteria or multiple?

Reply With Quote
  #3  
Old August 13th, 2003, 02:40 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: search MySQL Database

trying to set up for both.

Artoo Smith
artoo_s@hotmail.com

Reply With Quote
  #4  
Old August 13th, 2003, 03:06 PM
Blindeddie Blindeddie is offline
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: NJ - USA
Posts: 2,152 Blindeddie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 4
RE: search MySQL Database

well the basic single search query would be as follows

select * from my_table where my_field like '%my_search_term%'

that would select any records in my_field that either matched or contained my_search_term.

As for as multiple keyword searches, just use the OR operator like so

select * from my_table where my_field like '%my_search_term%' or my_field like '%my_search_term2%'

this will find any records that contain either my_search_term or my_search_term2

Of course this is a basic explaination, so for a more indepth look at searching, check out Matts tutorial at:

http://codewalkers.com/tutorials/46/1.html

Reply With Quote
  #5  
Old August 14th, 2003, 04:26 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: search MySQL Database

Thanks for the info!! Will take a look at that tutorial as well. Is it possible to search two fields of a database using this method?

Thanks again

Artoo Smith
artoo_s@hotmail.com

Reply With Quote
  #6  
Old August 14th, 2003, 06:04 PM
Blindeddie Blindeddie is offline
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: NJ - USA
Posts: 2,152 Blindeddie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 4
RE: search MySQL Database

yes it is, use the AND operator like so...

select * from my_table where my_field like '%my_search_term%' AND my_field2 like '%my_search_term2%'

or for multiple searches

select * from my_table where (my_field like '%my_search_term%' or my_field like '%my_search_term2%') and (my_field2 like '%my_search_term3%')


Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesDatabase Help > search MySQL Database


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway