jaronblake Posted June 6, 2006 Share Posted June 6, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/11347-get-only-part-data/ Share on other sites More sharing options...
ober Posted June 6, 2006 Share Posted June 6, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/11347-get-only-part-data/#findComment-42500 Share on other sites More sharing options...
jaronblake Posted June 6, 2006 Author Share Posted June 6, 2006 Is there a way to stop at a charrater like ( Quote Link to comment https://forums.phpfreaks.com/topic/11347-get-only-part-data/#findComment-42518 Share on other sites More sharing options...
ober Posted June 6, 2006 Share Posted June 6, 2006 substr($row['whatever'],0,strpos($row['whatever'], '('); Quote Link to comment https://forums.phpfreaks.com/topic/11347-get-only-part-data/#findComment-42520 Share on other sites More sharing options...
jaronblake Posted June 6, 2006 Author Share Posted June 6, 2006 [!--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 Quote Link to comment https://forums.phpfreaks.com/topic/11347-get-only-part-data/#findComment-42524 Share on other sites More sharing options...
ober Posted June 6, 2006 Share Posted June 6, 2006 Anytime... post here again if you have issues. Quote Link to comment https://forums.phpfreaks.com/topic/11347-get-only-part-data/#findComment-42526 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.