Skip site navigation (1) Skip section navigation (2)

Re: Limiting character count

From: Christoph Frick <frick(at)sc-networks(dot)com>
To: roy simkes <roysimkes(at)hotmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Limiting character count
Date: 2006-07-26 09:09:38
Message-ID: 20060726090938.GM25722@byleth.sc-networks.de (view raw or flat)
Thread:
Lists: pgsql-novice
On Wed, Jul 26, 2006 at 08:47:10AM +0000, roy simkes wrote:

> Hi,I'm have a field which allows maximum 1000 characters. But when I
> fecth it I only want to show first 50 characters and then give a link
> to see the whole data. Is there a way to do this easily with
> postgresql or I should do this using php functions and other logic
> things.I hope I was clear enough I should show something like this:Hi,
> I'm new in town and I'm a little bit lost can yo... (more)Where the
> whole text is :Hi I'm new in town and I'm a little bit lost can you
> show me where is Mr Brown's house?

this depends on what your applications is doing here. if you have a
large list (with the 50 char preview) then your "full view" will likely
be a seperate call (e.g. javascript window, iframe, ...); then you can
use the substring/string manipulation methods of postgres to only get
the data you need. and in the next call get only the full-data that are
requested by the user. but if you are only showing one row and want to
"hide" the full extend there, then you are better of by do you hiding it
in the app.

-- 
cu

In response to

pgsql-novice by date

Next:From: kmh496Date: 2006-07-26 09:13:19
Subject: Re: case-insensitive Index
Previous:From: roy simkesDate: 2006-07-26 08:47:10
Subject: Limiting character count

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group