How do I get the actual max length of a specified column in php (prior to PHP7)?
For instance, this table:
id – int(11)
name – string(20)
I want in php to select the maximum number of characters that a field can have, like
SELECT length(name) from table1
and it should then return 20 (since it’s the maximum number of characters for that field).
You should use
mysql_field_lenhttp://php.net/manual/en/function.mysql-field-len.php