Displaying the Image from MySQL, help please...
Posted: Sun Aug 26, 2007 12:04 pm
I was able to successfully upload the image to mysql, how can i display it though? let me know what's wrong with my query...
Code: Select all
<?php
mysql_connect("mysql", "username", "password") or die(mysql_error());
mysql_select_db("cleverwebdesigns");</p> <p>$result = mysql_query("SELECT id from upload");
while ($row = mysql_fetch_array($result)) {
$ids[]=$row['id'];
}
?>
<html>
<head>
<title>Image Loader</title>
</head></p><p><body>
select image:<br>
<table width="80%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="10%">id</td>
<td width="90%">Image</td>
</tr>
<tr>
<td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><a href="?id=<?= $id; ?>"><?= $id; ?></a></td>
</tr>
</table></td>
<td><img src="image.php?id=<?= $_GET['id']; ?>"></td>
</tr>
</table>
</body>
</html>