Jayso Posted April 23, 2006 Share Posted April 23, 2006 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) Link to comment https://forums.phpfreaks.com/topic/8160-number-of-characters-in-an-sql-field/ Share on other sites More sharing options...
dedart Posted April 23, 2006 Share Posted April 23, 2006 [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] Link to comment https://forums.phpfreaks.com/topic/8160-number-of-characters-in-an-sql-field/#findComment-29759 Share on other sites More sharing options...
Jayso Posted April 23, 2006 Author Share Posted April 23, 2006 Thanks mate Link to comment https://forums.phpfreaks.com/topic/8160-number-of-characters-in-an-sql-field/#findComment-29762 Share on other sites More sharing options...
ypirc Posted April 23, 2006 Share Posted April 23, 2006 [!--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 Link to comment https://forums.phpfreaks.com/topic/8160-number-of-characters-in-an-sql-field/#findComment-29765 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.