I am trying to show an image from the database to a new page using php. I am clicking on the image which needs to open in a new page. But everytime a same image is showing on the new page. I want an image in the new page which I clicked in last page. please help me.
<?php
$con = mysql_connect("localhost", "root" , "");
$sdb = mysql_select_db("display_images",$con);
$sql = "SELECT image FROM `tab1` WHERE 1";
$mq = mysql_query($sql) or die ("not working query");
$row = mysql_fetch_array($mq) or die("line 44 not working");
$s = $row['image'];
echo $row['image'];
echo '<img src="'.$s.'" alt="HTML5 Icon" style="width:800px;height:500px " >';
?>
var_dump()to check what your variables store, if they store nothing insert your query directly into MySQL using phpMyAdmin and see what data is being selected, if none, fix your query.die('Error: ' . mysql_error());tab1WHERE id='imageid';idfor identifying which image is clicked and moreover you are not iterating images, it seems you are using very first row coming through query only, this way you will always be getting one image.