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. 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. 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 ( 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'], '('); 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 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. Link to comment https://forums.phpfreaks.com/topic/11347-get-only-part-data/#findComment-42526 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.