homepage Welcome to WebmasterWorld Guest from 54.166.8.138
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

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




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

I tried

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

but that gave a query error

 

bobnew32




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

You need somthing dealing with the mysql full text searching I believe.

ocelot




msg:1264997
 8:43 pm on Nov 7, 2004 (gmt 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

jam13




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

How about:

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

ocelot




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

thanks jam that did it

villar




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

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 :)

coopster




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

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved