judy
October 10, 2015, 8:36am
1
Hello,
I have an issue, I want to retrieve images stored in phpmyadmin, but when I test it. It looks like that
my code is :
<?php
//show information
ini_set('display_errors',1);
error_reporting(E_ALL);
include "connect.php";
$q = "SELECT * FROM animaldata";
$r = mysqli_query($conn,$q);
if($r)
{
while($row=mysqli_fetch_array($r))
{
//header("Content-type: text/html");
echo "</br>";
echo $row['aname'];
echo "</br>";
echo $row['adetails'];
echo "</br>";
//$type = "Content-type: ".$row['aphototype'];
//header($type);
echo "<img src=image.php?ano=".$row['ano']." width=300 height=100/>";
}
}
else
{
echo mysql_error();
}
?>
anyone can help, I would be very grateful. and thank you
Firstly, you should use echo ' " please note that the quotes inside the are single quotes, and by the look of it, you have ended “image.php?ano=”.$row[‘ano’]." with nothing at the end of the period mark
Try this:
echo '<img src="image.php?ano="' .$row['ano'] .'" width="300" height="100" alt="' .$row['aname'] .'" />';
judy
October 10, 2015, 10:59am
4
I tried it but now I’m getting the name of the image only ,like that
What is your “image.php” source folder? Clearly getting the wrong folder, that is the problem
judy
October 10, 2015, 12:14pm
6
Thanks for your answers, I was missing base64_encode and a name typo, now it works.
system
Closed
January 9, 2016, 7:14pm
7
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.