[PHP-DB] RE: SELECT WHERE length of content question

2011-03-11 Thread Geoffrey Pitman
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.pigg...@actsministries.org
To: php-db@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/


Re: [PHP-DB] RE: SELECT WHERE length of content question

2011-03-11 Thread Constantin Brinzoi

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.pit...@gmail.com

To: php-db@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.pigg...@actsministries.org
To: php-db@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