SELECT WHERE length of content question

------=_NextPart_000_001A_01CBDE82.5E5E3C60
Content-Type: text/plain;
charset="UTF-8"
Content-Transfer-Encoding: quoted-printable


Is there a command in mySQL that would allow me to SELECT the rows where =
the `fax` column is more than 11 characters long?

OR

Do I need to use PHP to assess this?

Ron

The Verse of the Day
=E2=80=9CEncouragement from God=E2=80=99s Word=E2=80=9D
http://www.TheVerseOfTheDay.info

------=_NextPart_000_001A_01CBDE82.5E5E3C60--
ron.piggott [ Mi, 09 März 2011 23:49 ] [ ID #2056344 ]

Re: SELECT WHERE length of content question

--0016e6551f229daa17049e149b50
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

Have a look at this:
http://dev.mysql.com/doc/refman/5.1/en/string-functions.html #function_char-=
length

On Thu, Mar 10, 2011 at 9:49 AM, Ron Piggott <ron.piggott [at] actsministries.or=
g
> wrote:

>
> Is there a command in mySQL that would allow me to SELECT the rows where
> the `fax` column is more than 11 characters long?
>
> OR
>
> Do I need to use PHP to assess this?
>
> Ron
>
> The Verse of the Day
> =93Encouragement from God=92s Word=94
> http://www.TheVerseOfTheDay.info
>

--0016e6551f229daa17049e149b50--
Kesavan Rengarajan [ Mi, 09 März 2011 23:53 ] [ ID #2056345 ]

Re: SELECT WHERE length of content question

On Wed, Mar 9, 2011 at 17:49, Ron Piggott
<ron.piggott [at] actsministries.org> wrote:
>
> Is there a command in mySQL that would allow me to SELECT the rows where the `fax` column is more than 11 characters long?

There is.

SELECT * FROM tblName WHERE CHAR_LENGTH(fax) >= 11;

(Presuming you meant greater than or equal to eleven, as in an
invalid US/Canadian phone number.)

--
</Daniel P. Brown>
Network Infrastructure Manager
http://www.php.net/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Daniel Brown [ Do, 10 März 2011 00:38 ] [ ID #2056415 ]

RE: SELECT WHERE length of content question

--20cf307f326ac341ae049e38badd
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

You should be able to use the MySQL command LENGTH() command. I'm assuming
that your fax field is a varchar or char(10) field. If it's a number (which
it probably shouldn't be), I suppose you could write a query to find values
equal to or greater than 100,000,000,000.

http://dev.mysql.com/doc/refman/5.5/en/string-functions.html #function_lengt=
h

I hope this helps.

Geoff

---------- Forwarded message ----------
From: "Ron Piggott" <ron.piggott [at] actsministries.org>
To: <php-db [at] lists.php.net>
Date: Wed, 9 Mar 2011 17:49:42 -0500
Subject: SELECT WHERE length of content question

Is there a command in mySQL that would allow me to SELECT the rows where th=
e
`fax` column is more than 11 characters long?

OR

Do I need to use PHP to assess this?

Ron

The Verse of the Day
=93Encouragement from God=92s Word=94
http://www.TheVerseOfTheDay.info <http://www.theverseoftheday.info/>

--20cf307f326ac341ae049e38badd--
Geoffrey Pitman [ Fr, 11 März 2011 18:59 ] [ ID #2056439 ]

Re: RE: SELECT WHERE length of content question

Do not forget to use TRIM function as well:

LENGTH(TRIM(fax))

in order to elliminate leading and trailing spaces.

Aurel

----- Original Message -----
From: "Geoffrey Pitman" <geoffrey.pitman [at] gmail.com>
To: <php-db [at] lists.php.net>
Sent: Friday, March 11, 2011 7:59 PM
Subject: [PHP-DB] RE: SELECT WHERE length of content question


You should be able to use the MySQL command LENGTH() command. I'm assuming
that your fax field is a varchar or char(10) field. If it's a number (which
it probably shouldn't be), I suppose you could write a query to find values
equal to or greater than 100,000,000,000.

http://dev.mysql.com/doc/refman/5.5/en/string-functions.html #function_length

I hope this helps.

Geoff

---------- Forwarded message ----------
From: "Ron Piggott" <ron.piggott [at] actsministries.org>
To: <php-db [at] lists.php.net>
Date: Wed, 9 Mar 2011 17:49:42 -0500
Subject: SELECT WHERE length of content question

Is there a command in mySQL that would allow me to SELECT the rows where the
`fax` column is more than 11 characters long?

OR

Do I need to use PHP to assess this?

Ron

The Verse of the Day
“Encouragement from God’s Word”
http://www.TheVerseOfTheDay.info <http://www.theverseoftheday.info/>


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Constantin Brinzoi [ Fr, 11 März 2011 19:34 ] [ ID #2056440 ]
PHP » gmane.comp.php.database » SELECT WHERE length of content question

Vorheriges Thema: UPDATE IF
Nächstes Thema: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/mysql.so'