tags:

views:

250

answers:

1

Here's the code:

$conn = new mysqli('localhost', 'user', 'password', 'db');
$stmt = $conn->prepare('select Data  from sessions');
$stmt->execute();
$x = 234;
$stmt->bind_result($x);
$stmt->fetch();
var_dump($x);

This outputs:

string '' (length=0)

In fact the table contains exactly one row and the blob column contains some valid ASCII character data (a serialize()d PHP integer).

Why is this so?

Bump.

A: 

MySQLi probably doesn't like putting BLOB data into PHP variables. If you just need to store ASCII data, you should use a column type that's designed to store ASCII.

Rusky
The data will include non-ASCII characters as well. As a minimum there will be the NULL character.
Vilx-