I have a VARCHAR(4) column that receives data from an input that may be above 4 characters. This is okay, though, and I let MySQL naturally (or so I thought) cut off the end of the characters.
Strangely enough, when I'm looking at the database row results later in PHP (Using the PDO driver), the entire string is displaying, not just the 4 characters.
Weird thing is, if I do a SELECT query on the MySQL CLI, it only returns the 4 characters. Even when I do a mysqldump, only the 4 characters show.
Any idea what could cause this odd inconsistency?
Note that these characters are all numbers.
Edit: By request, here's some psuedocode that represents the save/fetch methods:
Storing:
$data = array(
'name_first4' => $fields['num'],
// name_first4 is the column name with VARCHAR(4)
);
$where = $this->getTable()->getAdapter()->quoteInto('id = ?', $id);
$this->getTable()->update($data,$where);
Fetching, using Zend_Db_Table:
$row = $this->getTable()->fetchRow(
$this->getTable()->select()->where('id=?',$data)
);