Limit chars from select
am 30.01.2006 02:22:16 von Gavin Amm
How do I limit the characters a Select statement returns?
In Seudo code:
SELECT * FROM myTable LIMITCHARS 30;
I'm using MySQL.
Thanks.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Limit chars from select
am 30.01.2006 02:51:06 von John in Pueblo
Gavin Amm wrote:
> How do I limit the characters a Select statement returns?
> In Seudo code:
> SELECT * FROM myTable LIMITCHARS 30;
>
> I'm using MySQL.
>
> Thanks.
>
Do you want to limit the characters from an individual field? If so, then
SELECT SUBSTRING(FIELD1 FROM 1 FOR 30) FROM myTable;
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
RE: Limit chars from select
am 30.01.2006 03:47:50 von Gavin Amm
I'd like to avoid having to manually add all of the cols to the select
statement if possible, so if there's a universal command I can put in
that'd be best.
Basically most of the fields are short.. 2 cols "action" and "comments"
are text so can be a bit lengthy. The 1st page is a sumary page of a
number of the rows, so what I'm wanting to do is limit the display on
initial sumary page to say 100 chars per field and then if they click on
the row for more info I can then display the full info.
-----Original Message-----
Sent: Monday, January 30, 2006 12:51 PM
To: Gavin Amm; php-db@lists.php.net
Subject: Re: [PHP-DB] Limit chars from select
Gavin Amm wrote:
> How do I limit the characters a Select statement returns?
> In Seudo code:
> SELECT * FROM myTable LIMITCHARS 30;
>=20
> I'm using MySQL.
>=20
> Thanks.
>=20
Do you want to limit the characters from an individual field? If so,
then
SELECT SUBSTRING(FIELD1 FROM 1 FOR 30) FROM myTable;
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Limit chars from select
am 30.01.2006 04:06:58 von John in Pueblo
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Gavin Amm wrote:
> I'd like to avoid having to manually add all of the cols to the select
> statement if possible, so if there's a universal command I can put in
> that'd be best.
In that case, what I would do is just do your SELECT statement, sans the
SUBSTRING() function, and then use PHP substr() to manually display the
first 30 characters.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFD3YLSj60GAoLuoDkRAlseAKD76nKk/heRkTqI3HPZFcgeuBkpbQCf fTBE
q6HiS8z3GdaghKFHcJOL284=
=MA7K
-----END PGP SIGNATURE-----
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php