I'm creating a Database where I have a big list of products and my client wants to have a picture of each product. The info of the products are on Mysql already:
id:
category:
model:
picture:
description:
application:
My Client wants to have a section to Add-products, Modify-products, and Erase-products which I already did, but I'm having troubles to insert the image of each product on the products table, that the clients will see.
When I add a product I go to my add-product.php where I have my fields:
category: new category
model: new model
picture: image2.jpg
description: new description
application: new aplication
And on my products.php will show just my table with the text, in this case on my picture field will just show "image2.jpg" The big question here is:
How can I insert my picture on my table from my Add-product.php?
here is the code from Add-product.php that insert the information I add:
$category=$POST['category'];
$model=$POST['model'];
$picture=$POST['picture'];
$description=$POST['description'];
$application=$_POST['application'];
$sql = "INSERT INTO client_products VALUES ('', '$category', '$model', '$picture', '$description', '$application');";
mysql_query($sql, $conn) or die (mysql_error());
header("location:products.php");
Here is the php code to insert the products on "products.php":
$conn = mysql_connect("mysql.dns77.com", "client", "password") or die (mysql_error());
mysql_select_db("client",$conn) or die(mysql_error());
$sql = "SELECT * FROM client_products ORDER BY 'id' ASC";
$result = mysql_query($sql, $conn) or die (mysql_error());
while ($cherche = mysql_fetch_array($result)) {
$id = $cherche['id'];
$categorie = $cherche['categorie'];
$model = $cherche['model'];
$picture = $cherche['picture'];
$description = $cherche['description'];
$application = $cherche['application'];
echo "<tr>
<td><table width='600' border='1' cellspacing='0' cellpadding='0'>
<tr>
<td width='80' height='100' align='center'><span class='style4'>$categorie</span></td>
<td width='80' height='100' align='center'><span class='style4'>$model</span></td>
<td width='100' height='100' align='center'><span class='style4'>$picture</span></td>
<td width='140' height='100' align='center'><span class='style4'>$description</span></td>
<td width='120' height='100' align='center'><span class='style4'>$application</span></td>
</tr>
</table></td>
</tr>";
}
echo "</table>"."<br />";
Please I'll appreciate your help.
Rod.