Welcome to WebmasterWorld Guest from 107.20.72.188

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

MYSQL: how do I select rows where a column contains a certain string?

     
8:37 pm on Nov 7, 2004 (gmt 0)

Junior Member

10+ Year Member

joined:Oct 22, 2004
posts:59
votes: 0


I tried

SELECT * FROM blog_posts WHERE keywords CONTAINS 'design' ORDER BY timestamp

but that gave a query error

8:40 pm on Nov 7, 2004 (gmt 0)

Full Member

10+ Year Member

joined:Apr 27, 2003
posts:243
votes: 0


You need somthing dealing with the mysql full text searching I believe.
8:43 pm on Nov 7, 2004 (gmt 0)

Junior Member

10+ Year Member

joined:Oct 22, 2004
posts:59
votes: 0


oh well see I need to have it find rows where the keywords column *contains* "design" but may also contain other stuff

so say I have a row where keywords = "ewoinfd cweowm wo design fwpom dwopkjo weo"

I want the query to return that row

9:10 pm on Nov 7, 2004 (gmt 0)

Junior Member

10+ Year Member

joined:Apr 10, 2004
posts:74
votes: 0


How about:

SELECT * FROM blog_posts WHERE keywords LIKE '%design%' ORDER BY timestamp

9:13 pm on Nov 7, 2004 (gmt 0)

Junior Member

10+ Year Member

joined:Oct 22, 2004
posts:59
votes: 0


thanks jam that did it

villar

6:42 am on Dec 12, 2004 (gmt 0)

Inactive Member
Account Expired

 
 


awesome jam :)

I had a similar prob to ocelot

I spent a whole night tryin to find the right answer and all that was missing from my script was a couple of percentage signs :: rolls eyes ::

cheers :)

1:06 pm on Dec 13, 2004 (gmt 0)

Administrator

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 31, 2003
posts:12537
votes: 0


We're glad you found us, villar. Welcome to WebmasterWorld.
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members