Board index   FAQ   Search  
Register  Login
Board index PHP PHP Scripts

Getting BLOB to return binary data

Links for php scripts

Moderators: macek, egami, gesf

Getting BLOB to return binary data

Postby kemnet » Tue Oct 02, 2012 4:56 pm

I have an issue. I have a database an PHP scripts. In the database there is an image field of image data type that stores the path to an image. Then in my query select * from table I get the image. How ever I changed the image data type to BLOB and uploaded the image in the database . How ever when i say the select statement on the table in the image field I get null. I was really hoping to know if there was some function I have to run on the image field (blob data type) so I could get the binary data of the images as the functions I see I don't really get. Thanks

This is the select statement
Code: Select all
{
    # 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 this is the Json
Code: Select all
            $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,   
kemnet
New php-forum User
New php-forum User
 
Posts: 1
Joined: Tue Oct 02, 2012 4:52 pm

Return to PHP Scripts

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.