Gossamer Forum
Home : General : Databases and SQL :

Searching MySQL

Quote Reply
Searching MySQL
Is there any way, when searching through a database to have the place where the object searched is found displayed?

eg. Someone is searching the word "truth" in my database. Say this is found in a line, "The truth is that the end is near." Instead of having that entire line returned, can I make it so that only "...truth is that..." or something to that extent?

I know that their is a LEFT() function to limit the characters result, however if this searched query is found in the middle of 12 paragraphs, how can I narrow down the displayed result?
Quote Reply
Re: [JoFrRi] Searching MySQL In reply to
You'll probably have to do this within your script using regular expressions. It is virtually impossible to do what you want within the MySQL select statement.
========================================
Buh Bye!

Cheers,
Me

Last edited by:

Stealth: Aug 18, 2003, 9:39 PM
Quote Reply
Re: [Stealth] Searching MySQL In reply to
Is it possible to do this using something like the trim() or ltrim() function in php?