Forums

This topic is locked

Show First (value) characters?

Posted 12 Jul 2004 23:42:16
1
has voted
12 Jul 2004 23:42:16 Chase Rage posted:
is there a way to only display the first (specified) amount of characters of a recordset feild on a page?

for example, say, i typed a 300 character article, with subject date and all that in the recordset. is there a way, so that on the page that lists the articles it only displays the first 50 characters of that 300 character article?

Replies

Replied 14 Jul 2004 14:40:53
14 Jul 2004 14:40:53 Kent Steelman replied:
Simplest method would be to allow a query to restrict the amount that is displayed to the first 50 char or so. Also another solution is to have two separate fields for what you intend. One for the article and the other for the subject field.

Wm. Kent Steelman
Replied 14 Jul 2004 23:42:22
14 Jul 2004 23:42:22 Dave Thomas replied:
use the LEFT function. and a value for the amount of characters, so...

<pre id=code><font face=courier size=2 id=code>&lt;%= (rsBlah.Fields.Item("articleField".value) %&gt;</font id=code></pre id=code>

would become

<pre id=code><font face=courier size=2 id=code>&lt;%= Left(rsBlah.Fields.Item("articleField".Value, 50)%&gt;...</font id=code></pre id=code>

notice the 3 trailing dots outside of the asp delimiter, this will give the text a blah blah... finish <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

there is also ways to do this with complete words so you dont cut a word in half.

Regards,
Dave

[DWMX 2004]|[FlashMX 2004 Pro]|[SQL]|[Access2000]|[ASP/VBScript]|[XP-Pro]
Replied 15 Jul 2004 02:00:31
15 Jul 2004 02:00:31 Chase Rage replied:
well i got it down, im using this method

<pre id=code><font face=courier size=2 id=code>&lt;# php echo substr($row_Recordset['feild'], 0, 200); #&gt;</font id=code></pre id=code>
Replied 15 Jul 2004 17:20:37
15 Jul 2004 17:20:37 Dave Thomas replied:
it helps if you tell us what coding language your question is for.

Regards,
Dave

[DWMX 2004]|[FlashMX 2004 Pro]|[SQL]|[Access2000]|[ASP/VBScript]|[XP-Pro]

Reply to this topic