Jump to content


Photo

?Preview of string?


  • Please log in to reply
6 replies to this topic

#1 xtheonex

xtheonex
  • New Members
  • Pip
  • Newbie
  • 8 posts
  • LocationBurton-Upon-Trent, Staffordshire, UK

Posted 28 March 2006 - 12:50 AM

Hi guys.
How do i create a preview of a string? Like if i bring something from a mysql db, the string name is $fetchbookmark['url']. But that string is too long to fit into the cell i want it to. So what i want to do is to take like the first 50 chrs for example of that string and just show them. Ive seen it on forum scripts and such so i know its possbile. Just not sure how to do it myself.

Thanks in advance,
Dave

#2 ToonMariner

ToonMariner
  • Members
  • PipPipPip
  • Advanced Member
  • 3,342 posts
  • LocationNewcastle upon Tyne, UK

Posted 28 March 2006 - 12:52 AM

[a href=\"http://uk.php.net/manual/en/function.substr.php\" target=\"_blank\"]substr[/a]

you may aslo need to [a href=\"http://uk.php.net/manual/en/function.strip-tags.php\" target=\"_blank\"]striptags[/a]
follow me on twitter @PHPsycho

#3 khendar

khendar
  • Members
  • PipPipPip
  • Advanced Member
  • 78 posts

Posted 28 March 2006 - 12:54 AM

You could use substr($fetchbookmark['url'], 0, 50).

#4 xtheonex

xtheonex
  • New Members
  • Pip
  • Newbie
  • 8 posts
  • LocationBurton-Upon-Trent, Staffordshire, UK

Posted 28 March 2006 - 12:56 AM

Thanks guys.
Most helpful and very prompt for 2 am, lol. Or you may not be in the UK like me, lol.

#5 ToonMariner

ToonMariner
  • Members
  • PipPipPip
  • Advanced Member
  • 3,342 posts
  • LocationNewcastle upon Tyne, UK

Posted 28 March 2006 - 12:57 AM

I AM!!!

Just can't sleep (again!)

follow me on twitter @PHPsycho

#6 xtheonex

xtheonex
  • New Members
  • Pip
  • Newbie
  • 8 posts
  • LocationBurton-Upon-Trent, Staffordshire, UK

Posted 28 March 2006 - 01:01 AM

I can sleep, im just gettin quite obsessed with php at the mo. I started learnin it for about a year and then took a break for about a year and now im gettin back into it.
Only problem ive got is i need projects so that i can work on something to really test myself if ya know what i mean.

#7 khendar

khendar
  • Members
  • PipPipPip
  • Advanced Member
  • 78 posts

Posted 28 March 2006 - 01:06 AM

Heh...its almost lunch time here :P




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users