I am creating a photo gallery using PHP and MYSQL. I want the mages and the captions under them to have a hyperlinks on them. The hyperlink for both the image and the caption under it will go to the same web page. How do I get images and their captions to display on a web page using php and mysql? It's important that the images and the captions have links on them. Image of the PhpMymin database and table This is the code:
<!DOCTYPE html>
<html>
<body>
<?php
mysql_connect ("localhost", "root", "");
mysql_select_db ("display_images");
$result = mysql_query("SELECT * FROM table1");
echo "<table>";
while ($row = mysql_fetch_array($result)) {
echo "<tr>";
echo "<td>"; ?>
echo '<a href="'$row ["imagelink"].'"><img src="img/'.echo $row ["images1"].'" width="150" height="150" alt=""> <br>'
echo $row ["caption"] </a>' </td>; echo "</td>";
echo "</tr>";
}
echo "</table>";
?>
</body>
</html>