I've finally fixed it.
The code now looks like this:
$stmt = $dbcon->prepare( 'SELECT CREATIVE FROM creative WHERE id = 10314612');
$stmt->execute();
$res = $stmt->fetchAll( PDO::FETCH_ASSOC );
for( $i=0; $i<count($res); $i++ ){
$data = stream_get_contents( $res[$i]['CREATIVE'] );
}
Thanks for your help Passerby.
I don't understand why it works. I just copied the above from one of the examples on php.net
If anyone knows why, it would be great if they could post it here :)