I have this php code that grabs binary( blob ) data from the database and displays as an image in a browser. However, everything after this is ignored. Is there a way that I can also use text queries/forms/tables? Basic HTML elements on the same page?
Having a page that can only display a picture from the DB and nothing else is useless to me.
<?php
$mysqli=mysqli_connect('localhost','root','','draftdb');
if (!$mysqli)
die("Can't connect to MySQL: ".mysqli_connect_error());
$imageid= 1;
$stmt = $mysqli->prepare("SELECT PICTURE_ID FROM display WHERE INDEX_ID =?");
$stmt->bind_param("i", $imageid);
$stmt->execute();
$stmt->bind_result($image);
$stmt->fetch();
header("Content-Type: image/jpeg");
echo $image;
?>
No, you can only have one
Content-Typeper page.What you should do is simply create another page, that contains both an image (with src pointing to the code you showed) and the form you want to display, like this: