Jump to content


Photo

get only part data


  • Please log in to reply
5 replies to this topic

#1 jaronblake

jaronblake
  • Members
  • PipPip
  • Member
  • 17 posts

Posted 06 June 2006 - 05:37 PM

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.

#2 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 06 June 2006 - 05:41 PM

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.

Info: PHP Manual


#3 jaronblake

jaronblake
  • Members
  • PipPip
  • Member
  • 17 posts

Posted 06 June 2006 - 06:14 PM

Is there a way to stop at a charrater like (

#4 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 06 June 2006 - 06:21 PM

substr($row['whatever'],0,strpos($row['whatever'], '(');

Info: PHP Manual


#5 jaronblake

jaronblake
  • Members
  • PipPip
  • Member
  • 17 posts

Posted 06 June 2006 - 06:26 PM

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

Thanks you have been a big help


#6 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 06 June 2006 - 06:28 PM

Anytime... post here again if you have issues.

Info: PHP Manual





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users