I'm trying to use mysqli to fetch a single column from a row.
Here's the code I'm using:
<?php
include('config.php');
$stmt = $db->prepare('select `data` from `wallpapers` limit 1');
$stmt->execute();
$stmt->store_result();
$stmt->bind_result($img);
$stmt->fetch();
//header( "Content-type: image/jpg");
var_dump($img);
?>The column `data` is a longblob. But the output is always: string(0) ""
Is there a special way of retrieving blob data? If I try to retrieve any other column, it works fine. But not the data column.
EDIT: Okay, I found the problem... When storing the blob data in the database with mysqli, the type of the blob data was 'b'. Apparently that doesn't work. I changed it into string type ('s') and now it works fine. So it wasn't a problem with retrieving the data, but inserting the data.
EDIT again: And now I found out why it didn't work

So if you're wondering, if you want to send blob type data, you need to use the send_long_data function -
http://uk2.php.net/manual/en/mysqli-stmt.send-long-data.phpI tried it again and now it's fine.