Jump to content

Archived

This topic is now archived and is closed to further replies.

jaronblake

get only part data

Recommended Posts

I am trying to get some info from a value in mysql, but i dont want the whole value just the first few words. I do want the data later but i want it as a short preview of what is in the row.

Share this post


Link to post
Share on other sites
It depends on how you want to do it... by words or characters or what. You can use substr($row['mytext'],0,30) to get the first 30 characters, or modify to however you want it.

If you want to do it by word count (not as repeatable and extremely variable across stories), do a search on this board as this has been done a hundred times.

Share this post


Link to post
Share on other sites
substr($row['whatever'],0,strpos($row['whatever'], '(');

Share this post


Link to post
Share on other sites
[!--quoteo(post=380711:date=Jun 6 2006, 12:21 PM:name=ober)--][div class=\'quotetop\']QUOTE(ober @ Jun 6 2006, 12:21 PM) [snapback]380711[/snapback][/div][div class=\'quotemain\'][!--quotec--]
substr($row['whatever'],0,strpos($row['whatever'], '(');
[/quote]

Thanks you have been a big help

Share this post


Link to post
Share on other sites
Anytime... post here again if you have issues.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.