I have an issue. I have a database(PHPadming) and PHP scripts. In the database there is an image field that stores the path to an image. The query SELECT * FROM TABLE returns all relevant information including the image.
However, I changed the image data type to BLOB and uploaded the image in the database . When I execute the SELECT statement on the table in the image field I get null. What i actually am expecting to get was the binary of the image. I googled the issue and see people mentioning functions like SELCET TO_CHAR(blobfield) FROM TABLE however that does not seem to work for me. WAs wondering if anyone could help.
P.S i do know this is bad practice but i already know how to use the path, im just trying it this way
this is my query
{
# search on license number
$l_name=$_POST["l_name"];
$stmt = $this->db->prepare('SELECT id, image,license_num,l_name,f_name,DATE_FORMAT(birth_d,\'%e-%m-%Y\') AS birth ,DATE_FORMAT(expires,\'%e-%m-%Y\') AS
expires,license_type,license_status,CASE WHEN CURDATE( ) >= `expires` THEN \'Expired\' ELSE \'Not Expired\' END AS status FROM license WHERE l_name=?');
//-- DUMP ( CAST ( image AS image( 50 ) ) )
$stmt->bind_param("s",$l_name);
$stmt->execute();
$stmt->bind_result($id,$image,$license_num,$l_name,$f_name,$birth,$expires,$license_type,$license_status,$status);
}
And the Json that says image is null
$result[] = array(
"image"=>$image,
"license_num"=>$license_num,
"l_name"=>$l_name,
"f_name"=>$f_name,
"birth"=>$birth,
"expires"=>$expires,
"license_type"=>$license_type,
"license_status"=>$license_status,
"status"=>$status,