Jump to content

Recommended Posts

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,

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.