image database
Posted: Thu Dec 22, 2005 10:08 pm
HawleyJR | Please use
why won't my images appear?
HawleyJR | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
I'm trying to design an image database like this:
[url]http://hitchcock.itc.virginia.edu/Slavery/return.php?categorynum=1[/url]
so far i wrote my php code as:Code: Select all
<?php
// Make a MySQL Connection
mysql_connect("localhost", "myID", "myPSW") or die(mysql_error());
mysql_select_db("image") or die(mysql_error());
$result = mysql_query("SELECT * FROM tbimg")
or die(mysql_error());
echo "<table border='1'>";
echo "<tr> <th>id</th> <th>image</th> <th>description</th><th>price</th></tr>";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table
echo "<tr><td>";
echo $row['id'];
echo "</td><td>";
header("Content-type: image/jpeg");
echo <img src=\"{$row['image']}\">
echo "</td><td>";
echo $row['description'];
echo "</td><td>";
echo $row['price'];
echo "</td></tr>";
}
echo "</table>";
?>HawleyJR | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]