/    Sign up×
Community /Pin to ProfileBookmark

help with mysql statement selecting only part of a string

hi i only want to return rows from my db that contains a word within the string of a specific column. I guess I’ll try and explain it with pseudo code

[code=php]$search = mysql_query(“SELECT column1 FROM table1 WHERE column1 contains the word ‘bottle’ within the contents of that column”);[/code]

That’s basically it in a nutshell. I’ve been trying to use substring and substr but don’t really know if that is the right thing to use. Basically im trying to build a site search.

thanks

chris

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@cannon303authorJun 21.2008 — found it thanks, i needed to use the like statement. Must remember to use this forum's search function more often here!
Copy linkTweet thisAlerts:
@rootJun 22.2008 — Well if its resolved you should use the thread tools to mark the thread as [RESOLVED]
×

Success!

Help @cannon303 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...