<!-- HTML CODE BEIGNS -->
<html>
<head>
<title> Image Showing </title>
</head>
<body>
<a href="ShowImage.php?id=1">IMG1</a>
<a href="ShowImage.php?id=2">IMG2</a>
<a href="ShowImage.php?id=3">IMG3</a>
</body>
</html>
<html>
<head>
<title> Image Showing </title>
</head>
<body>
<a href="ShowImage.php?id=1">IMG1</a>
<a href="ShowImage.php?id=2">IMG2</a>
<a href="ShowImage.php?id=3">IMG3</a>
</body>
</html>
<!-- HTML CODE ENDS -->
------------------------------------------------------------------------------------------------------------
<!-- PHP CODE BEGINS -->
<?php
$id=$_GET[id];
$con=mysqli_connect("localhost","root","","images");
if(mysqli_connect_errno())
{
echo "Failed To Connect"." ".mysqli_connect_errno();
}
$sql="SELECT * FROM Table1 WHERE Id=".$id; // in single qoutes(' ') string types values only
$rs=mysqli_query($con,$sql);
while($row=mysqli_fetch_array($rs))
{
$check=$row[img_name];
}
echo "<img src='$check'>";
?>
<!-- PHP CODE ENDS -->
No comments:
Post a Comment