Jump to content
Larry Ullman's Book Forums

How Do We Avoid Cutting The Last Word When Using The Left Or Right Function In Mysql To Select A Number X Of Characters From The Database?


Recommended Posts

Hello,

 

How do we avoid cutting the last word when using the Left Or Right function in MYSQL to select a number x of characters from the database?

 

If it is not possible with the mysql, is there any way to do it in PHP ?

 

 

Bahaa,

Link to comment
Share on other sites

I think the RIGHT and LEFT calls in MySQL return a string by character length. I don't really know the answer, maybe explode the string returned and return 1 less than the length of elements that way you wouldn't run the risk that the last element is only a partial word...?

Link to comment
Share on other sites

 Share

×
×
  • Create New...