Evening, afternoon, morning depending on where u are. I am very very new to this php, mysql dance and want to simply display images (longblob) and text out of my database but for some reason the images arent showing up. This is the code... (dont laugh)
<?php
$db = mysql_connect("localhost","root");
mysql_select_db("antiques",$db) or die(mysql_errno() . ": " . mysql_error() . "<br>");
$sql = "SELECT * FROM general ";
$sql .= "ORDER BY filename ASC";
$result = mysql_query($sql, $db);
$rows = mysql_num_rows($result);
echo "<table border=1>\n";
echo " <tr>\n";
echo " <td>Image</td>\n";
echo " <td>Name</td>\n";
echo " <td>Description</td>\n";
echo " <td>Price</td>\n";
echo " <td> </td>\n";
echo " </tr>\n";
for ($i = 0; $i < $rows; $i++) {
$data = mysql_fetch_object($result);
echo " <td><IMG SRC=getdata.php?id=$i></td>\n";
echo " <td>$data->name</td>\n";
echo " <td>$data->description</td>\n";
echo " <td>$data->price</td>\n";
echo " </tr>\n";
}
mysql_free_result($result);
mysql_close($db);
?>
...and this the getdata.php (which came from this site). If anyone doesnt mind helping me out here it would be much appreciated..
<?php
if(isset($id)) {
@MYSQL_CONNECT("localhost","root");
@mysql_select_db("antiques");
$query = "select image,filetype from image where id=$id";
$result = @MYSQL_QUERY($query);
$data = @MYSQL_RESULT($result,0,"image");
$type = @MYSQL_RESULT($result,0,"filetype");
Header( "Content-type: $type");
echo $data;
};
?>