Here is an example of the code I've tried - as recommended from several searches...
code working in directory:
//get blob (logo)
$sql = "SELECT logo FROM files WHERE fleetnumber='$fleetnumber'";
$query_results = mysql_query($link, $sql);
echo '<img src="'.mysql_result($query_results, 0).'">';
I stored a .png in the variable logo in table 'files'
I get the message "the image "http:///localhost:8000/cc/fleetadmin/" cannot be displayed because it contains errors
<<< that's a PHP message - does it contain a clue to what I'm missing??? I've tried with mysqli_query & mysqli_result - same thing
Umm...yeah you do not use HTML when outputting binary data like an image. The HTML has to go into a different page that calls for the image. Now unless you actually need to have the images stored within MySQL, it would be better to have them stored on the file system accessible via the web server and only store the path in the database.
if you absolutely must store it in the database, then point your image tag to another PHP file, which contains something to the effect of:
But as logic_earth pointed out, it's recommended to store the image data seperately and just put a link to the file in the database.
This topic is now closed. New replies are no longer allowed.