Jump to content

Archived

This topic is now archived and is closed to further replies.

Jayso

Number of characters in an SQL Field

Recommended Posts

Is there a SQL or PHP function that can tell me how many characters there are in a certain field of text? (i assume there is)

Share this post


Link to post
Share on other sites
[a href=\"http://au2.php.net/strlen\" target=\"_blank\"]http://au2.php.net/strlen[/a]
Count the number of characters in a string!

Google is good too when u wanna find these things:
[a href=\"http://www.google.com/search?q=php+count+characters&start=0&ie=utf-8&oe=utf-8&client=firefox-a&rls=org.mozilla:en-US:official\" target=\"_blank\"]http://www.google.com/search?q=php+count+c...:en-US:official[/a]

Share this post


Link to post
Share on other sites
[!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']SELECT[/span] LENGTH(column) [color=green]FROM[/color] [color=orange]table[/color] [!--sql2--][/div][!--sql3--]
OR
[!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']SELECT[/span] CHAR_LENGTH(column) [color=green]FROM[/color] [color=orange]table[/color] [!--sql2--][/div][!--sql3--]


From: [a href=\"http://dev.mysql.com/doc/refman/5.0/en/string-functions.html\" target=\"_blank\"]http://dev.mysql.com/doc/refman/5.0/en/string-functions.html[/a]

[quote]

CHAR_LENGTH(str)

Returns the length of the string str, measured in characters. A multi-byte character counts as a single character. This means that for a string containing five two-byte characters, LENGTH() returns 10, whereas CHAR_LENGTH() returns 5.

CHARACTER_LENGTH(str)

CHARACTER_LENGTH() is a synonym for CHAR_LENGTH().

[/quote

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.