I am pretty new to PHP and MySql and am having trouble with I think a LongBlob column in my DB. the entire error is here
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[01004]: String data, right truncated' in Client.php:110 Stack trace: #0 Client.php(110): Client::FindByOwnerID() #1 User.php(91): Client->FindByOwnerID('2') #2 UserController.php(26): User->FindByID('2') #3 {main} thrown in Client.php on line 110
I only seem to get this error if I upload an image to a LongBlob column. If I delete the row with the image everything works great.
I am using PDO to connect to to my database, I have searched for a solution but have only found similar problems that do not seem to mention anything about Images...
Is this a SQL Config issue, am I missing a PDO attribute?
Here is my PDO code
$dbConnString = "mysql:host=" . DB_SERVER . ";port=".DB_PORT."; dbname=" . DB_DATABASE;
$this->dbConnection = new PDO($dbConnString, DB_USERNAME, DB_PASSWORD);
$this->dbConnection->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
$this->dbConnection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
I personaly prefer not to store images in database but if you need to : check the image size it if it exceeds 1MB you have to increase the max_allowed_packet option in the server configuration file. You can change that in the Startup Variables section in the MySQL Administrator on the Networking page.
Check this link
http://dev.mysql.com/doc/refman/5.0/en/program-variables.html