www.webdeveloper.com
Results 1 to 4 of 4

Thread: Limiting characters of displayed results

  1. #1
    Join Date
    Dec 2011
    Posts
    23

    Limiting characters of displayed results

    Hello, I'm having trouble applying the substr function to the following code below. I'm trying to limit to amount of characters displayed from the 'headline' to 60, It should be simple enough but i keep getting syntax errors.

    PHP Code:
    <?php print "<div class='resultHeading'> <a href= 'javascript: void(0)'> ".$row['headline']." </a>  ";?>
    This is a simple example of of how the substr is used:

    PHP Code:
    <?php print substr($smallDesc0,129); print"..."?>
    Thanks

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,176
    Is this what you're looking for?
    PHP Code:
    <?php print "<div class='resultHeading'> <a href= 'javascript: void(0)'> ".substr($row['headline'], 060)." </a>  ";?>
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    Dec 2011
    Posts
    23
    thank you so much for the fast response, it works like a charm. The periods threw me off

  4. #4
    Join Date
    Dec 2011
    Posts
    23
    aup

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles