Skip to main content
Known Participant
June 19, 2009
解決済み

Cfquery help..

  • June 19, 2009
  • 返信数 2.
  • 476 ビュー

Hi guys,

           I am pulling data from a table which has 3 columns name, description and id, I want to display only top 20 char from descrption and a link when they click it will give entire description, I am not sure how to restrict to daisply only 20 char,...

Thanks you

    このトピックへの返信は締め切られました。
    解決に役立った回答 craigkaminsky

    If you're looking to limit the characters in your output (as opposed to doing it at the DB-level), you can just use something like the following:

    <cfset only20 = Left( myquery.description, 20 ) />

    The string function Left() returns the X most characters from a String.

    返信数 2

    Inspiring
    June 19, 2009

    Different db's have different functions that allow you to do this in your query.  These functions have names like left(), or substr().  google "your db string functions" to see what's available to you.

    craigkaminsky解決!
    Inspiring
    June 19, 2009

    If you're looking to limit the characters in your output (as opposed to doing it at the DB-level), you can just use something like the following:

    <cfset only20 = Left( myquery.description, 20 ) />

    The string function Left() returns the X most characters from a String.