Announcement

Collapse
No announcement yet.

Limiting number of characters displayed?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Limiting number of characters displayed?

    Hello,

    In my search results, the profile of a user will be displayed from a mysql database. How can I display only the first 500 characters?

    Thanks,

    Tim
    Five Star Review Script - Add reviews to your website!
    Mixed Martial Arts - Houston MMA Training
    Women's Self-Defense - Courses and DVDs available

  • #2
    Use LEFT...its a cool little thingie that goes X number of character from the left side of a string...

    Now the syntax is simple:
    LEFT(string,length)

    Here is an example:

    SELECT LEFT(text,500) FROM post WHERE postid = '100'

    this will return the first 500 characters of the text in post number 100

    that should be simple enough to explain...hope that helps

    Comment


    • #3
      Hi,

      Thanks for the input. I've got a fairly large select statement already which starts as SELECT * FROM $table_name WHERE....

      Should I just make a new select statement or is there a way to incorporate your select statement and combine it with the one I already have.

      Thanks,

      Tim
      Five Star Review Script - Add reviews to your website!
      Mixed Martial Arts - Houston MMA Training
      Women's Self-Defense - Courses and DVDs available

      Comment


      • #4
        SELECT LEFT(*, 200) FROM $table_name WHERE ....

        think that is what u would use

        --James

        Comment

        widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
        Working...
        X