Searching for text in a database

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Covenant
Forum Newbie
Posts: 15
Joined: Sun Oct 02, 2005 3:30 pm

Searching for text in a database

Post by Covenant »

How do you search for text/words/sentences in a TEXT field in a database?

Let's say this is a text field (named popularity) in Jimmy's row:
sarah=25, jessie=14, sam=33, kelly=42, joe=7
How would you just return just the number after Sarah?

i.e. (this isn't the real thing obviously)

Code: Select all

mysql_query("SELECT from subscribers where owner='Jimmy', SEARCH for word sarah in 'popularity' field, return the number 25");
Okay that was confusing.

And if you can't answer that one, at least answer this one: The following code, is it compatible with all browsers and guaranteed to successfully redirect everytime?

Code: Select all

<meta http-equiv=\"refresh\" content=\"3; url=SOME URL\">
Is there some other redirection script compatible with all browsers?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

look up the LIKE keyword, or full-text searching..
Post Reply