Is there anything special I need to do when selecting a blob from MySQL? I get a NULL for the following (data is a mediumblob, file_extension is varchar):
$sql = "SELECT data, file_extension FROM table1 WHERE table1.id = ?";
$q = $con->prepare($sql);
$q->execute(array(1));
if ($q->rowCount() == 0)
{
disconnectSqlConnection($con);
$arr = array('success' => 'false',
'error' => -2);
return json_encode($arr);
}
else
{
$row = $q->fetch();
$arr = array('success' => 'true',
'data' => $row[0],
'extension' => $row[1]);
disconnectSqlConnection($con);
return json_encode($arr);
}
$row[1] has 'pdf', which is correct. $row[0] is NULL, but in the database, I see a blob of size 244.8KB
Any thoughts?