im having problem with this 2 pages of code i have.the only problem is when im going to display it in another page called view.php
added.php
<?php
$type = $_POST['type'];
$size = $_POST['size'];
$quantity = $_POST['quantity'];
$prize = $_POST['prize'];
$file = $_FILES['image']['tmp_name'];
if (isset($_POST['submit']))
{
include('sql.php');
if (!isset($file)){
echo "Please Select an Image";
}
else{
$image = addslashes(file_get_contents($_FILES['image']['tmp_name']));
$image_name = addslashes($_FILES['image']['name']);
$image_size = getimagesize($_FILES['image']['tmp_name']);
if(!$image_size){
echo "Invalid File Type";}
else{
$query= "INSERT INTO tbcatalog VALUES('','$image_name','$image','$type','$size','$quantity','$prize')";
$result = @mysql_query($query);
$lastid = mysql_insert_id();
echo "Product Successfully Added<img src=view.php?id=$lastid>";
mysql_close();
}
}
}
?>
view.php
<html>
<head>
<link rel="icon" href="images/logo1.png" type="images/png ">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white"><table align="center" border="1" width="100%" height="25%"><td><img src="images/images-2.jpeg" width="1020" height="290"></td></table>
<div class="style1" align="left">
<p class="title">Products</p>
<?php
// Script name: view.php
// Description: The display/view all records in the database
include('sql.php');
header("Content-type: image/jpeg");
$id = $_GET['id'];
$query = "select * FROM tbcatalog where id='".$id."'";
$result = @mysql_query($query);
mysql_close();
?>
<table class="table3" border="1" cellspacing="3" cellpadding="3">
<tr>
<th class="text2">#</th><th class="text2">ID</th><th class="text2">Product Name</th><th class="text2">Image</th><th class="text2">Product Type</th><th class="text2">Size</th><th class="text2">Stock</th><th class="text2">Prize</th><th class="text2">Task</th>
</tr>
<?php
$i=1;
while ($row = mysql_fetch_assoc($result)){
$img = $row['image'];
echo "<tr><td bgcolor=\"white\">".$i."</td>";
echo "<br";
echo "<tr><td bgcolor=\"white\">".$row['id']."</td>";
echo "<br";
echo "<tr><td bgcolor=\"white\">".$row['name']."</td>";
echo "<br";
echo "<tr><td bgcolor=\"white\">".$img."></td>";
echo "<br";
echo "<tr><td bgcolor=\"white\">".$row['type']."</td>";
echo "<br";
echo "<tr><td bgcolor=\"white\">".$row['size']."</td>";
echo "<br";
echo "<tr><td bgcolor=\"white\">".$row['quantity']."</td>";
echo "<br";
echo "<tr><td bgcolor=\"white\">".$row['prize']."</td>";
echo "<br";
echo "<tr><td bgcolor=\"white\"><a href='update.php?id=" . $row['id'] . "'><img alt=\"Edit\" height=\"15\" src=\"icons/edit-icon.jpg\" width=\"15\"></a><img alt=\"Delete\" height=\"15\" src=\"icons/delete-icon.jpg\" width=\"15\"><img alt=\"Edit\" height=\"15\" src=\"icons/view-icon.jpg\" width=\"15\"></td>";
echo "</tr>";
echo "<br>";
echo "<img src='view.php?id=".$id."'>";
$i++;
}
mysql_free_result($result);
?>
<h3 style="font-family:'Arial Black'">total products: <?php echo($i-1); ?> </h3>
</table>
</html>
when i execute the view.php its show a broken image
any help is much appreciated ty