Ok I have a question, when im editing a product it shows its current image. You can either choose to delete the image, it removes it an gives it the no-item image. Also they can upload a new one when checking the checkbox, but a small question.
If they check the thumbnail image only and not the large image wouldnt the number in thumbnail have to be 0 and not 1?
function productEdit($id) {
// Add the product to the store
$cat = $_POST["cat"];
$name = $_POST["name"];
$description = $_POST["description"];
$price = str_replace(',', '', (double)$_POST["price"]);
$quantity = (int)$_POST["quantity"];
$upimage = isset($_POST["upimage"]) ? "on" : "";
$upthumb = isset($_POST["upthumb"]) ? "on" : "";
// Upload/Edit/Remove images and update using checkboxes
if ($upimage == "on") {
// Delete old Image
$query = db_query("SELECT image_large FROM store_product WHERE id = $id");
$result = db_fetch_object($query);
if ($result->image_large != "images/items/no-item.gif") {
unlink("$result->image_large"); }
// Upload new one
$image = "images/items/".$_FILES["image"]["name"][0];
copy($_FILES["image"]["tmp_name"][0], $image);
$query = db_query("INSERT INTO store_product (image_large) VALUES ('$image')"); }
if ($upthumb == "on") {
// Delete old Image
$query = db_query("SELECT image_thumb FROM store_product WHERE id = $id");
$result = db_fetch_object($query);
if ($result->image_thumb != "images/items/no-item.gif") {
unlink("$result->image_thumb"); }
// Upload new one
$thumb = "images/items/".$_FILES["image"]["name"][1];
copy($_FILES["image"]["tmp_name"][1], $thumb);
$query = db_query("INSERT INTO store_product (image_thumb) VALUES ('$thumb')"); }
// Update settings
$query = "UPDATE store_product SET id_cat = '$cat', name = '$name', description = '$description',
price = '$price', quantity = '$quantity' WHERE id = '$id'";
$result = db_query($query);
}