An alternative would be to ammend your select statement to do the trimming:

<cfquery...>
SELECT LEFT(description, 50)
FROM mytable
</cfquery>

This will reduce trafic between the dB and CF, and make the dB do more
of the work. This could be significant if you were retrieving huge
numbers of enourmous descriptions.

Cheers
Bert

----- Original Message -----
From: John Stanley <[EMAIL PROTECTED]>
Date: Wed, 29 Sep 2004 15:18:55 -0400
Subject: RE: Truncating database field
To: CF-Talk <[EMAIL PROTECTED]>

I do something similar for my blog on my homepage http://www.stangocity.com
<http://www.stangocity.com>

<cfoutput query="hotnews">
     #title#<br>
     #left(description,50)#......
</cfoutput>

-----Original Message-----
From: Mark Henderson [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 29, 2004 3:16 PM
To: CF-Talk
Subject: Truncating database field

Currently I have a hotnews page which calls information from an access
database table. In this table when the data is entered it captures the date
and time, and I would now like to be able to do two things with this. In
another linked page I'd like to display the title and only the first 50
characters of the relevant description field for each item. A google search
didn't reveal much. I'm sure this is possible..any ideas?

Here's the query...
<cfquery datasource="#request.dsn#" name="hotnews">
   SELECT
     news_ID,title,description,image,date_added,active
   FROM
     hot_news
</cfquery>

TIA
MarkH
   _____________________________________
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to