CodeIgniter Forums
maximum field lengths - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: maximum field lengths (/showthread.php?tid=5769)



maximum field lengths - El Forum - 02-03-2008

[eluser]Unknown[/eluser]
I wish to grab the maximum _allowable_ field length for a mysql field.
NOT the value returned by field meta data which only returns the length of the values in the field.
The value would normally be returned by msyql_field_len that provides the maximum allowable length as described by the database schema.
the value returned by field meta data with CI is just a string length of the longest value in that column.

Is this possible with CI?

Kind regards
Kevin


maximum field lengths - El Forum - 02-03-2008

[eluser]Michael Wales[/eluser]
Hmm, I've never used it, but even the docs say it returns the length of the specified field.

Code:
$this->db->select('username');
$query = $this->db->get('users');
echo mysql_field_len($query);