I have a sqlite db and like to load an image out of it and show it on site. Unfortunately, once I echo the image (which works) nothing else will be shown. So I guess I am missing something here.
That's my code:
get_image.php
<?php
function get_icon($id){
$db = new PDO('sqlite:rdb.db3');
$sql = "SELECT * FROM icons WHERE _id = " . $id;
$query = $db->query($sql);
$result = $query->fetch(PDO::FETCH_ASSOC);
header("Content-Type: image/png");
echo $result["bytes"];
}
?>
show.php
<?php
ini_set('display_errors',"1");
require_once 'get_image.php';
$id = $_GET['id'];
$icon = get_icon($id);
?>
<p>Show further content...</p>
Anyone who could possibly help me out here?
Thanks in advance! :)
Andreas
get_icon()does anything change? What steps have you taken to isolate the problem?