Link to home
Start Free TrialLog in
Avatar of dino_angelides
dino_angelides

asked on

Unlinking an image from a website

I have an update form and one of the options to be update are the images
<input name="image1" type="file" class="style81" id="image1" size="20" /> thats a sample of the  file field.
Lets say a user added an image when they were adding a product and now with the update of that product they want to unlink a specific image - remove it from the website
how can it be done?
below is my update statement, generated with dreamweaver
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
  $updateSQL = sprintf("UPDATE enginesubcategory SET make=%s, model=%s, `year`=%s, engine=%s, cc=%s, cyl=%s, type=%s, fuel=%s, thumbnail=IFNULL(%s,thumbnail), product=%s, comments=%s, commentsExtras=%s, image1=IFNULL(%s,image1), image2=IFNULL(%s,image2), image3=IFNULL(%s,image3), image4=IFNULL(%s,image4), image5=IFNULL(%s,image5), image6=IFNULL(%s,image6), image7=IFNULL(%s,image7), image8=IFNULL(%s,image8), image9=IFNULL(%s,image9), image10=IFNULL(%s,image10), image1Big=IFNULL(%s,image1Big), image2Big=IFNULL(%s,image2Big), image3Big=IFNULL(%s,image3Big), image4Big=IFNULL(%s,image4Big), image5Big=IFNULL(%s,image5Big), image6Big=IFNULL(%s,image6Big), image7Big=IFNULL(%s,image7Big), image8Big=IFNULL(%s,image8Big), image9Big=IFNULL(%s,image9Big), image10Big=IFNULL(%s,image10Big) WHERE id=%s",
                       GetSQLValueString($_POST['make'], "text"),
                       GetSQLValueString($_POST['model'], "text"),
                       GetSQLValueString($_POST['year'], "text"),
                       GetSQLValueString($_POST['engine'], "text"),
                       GetSQLValueString($_POST['cc'], "text"),
                       GetSQLValueString($_POST['cyl'], "text"),
                       GetSQLValueString($_POST['type'], "text"),
                       GetSQLValueString($_POST['fuel'], "text"),
                       GetSQLValueString($_POST['thumbnail'], "text"),
                       GetSQLValueString($_POST['product'], "text"),
                       GetSQLValueString($_POST['details'], "text"),
                       GetSQLValueString($_POST['extraDetails'], "text"),
                       GetSQLValueString($_POST['image1'], "text"),
                       GetSQLValueString($_POST['image2'], "text"),
                       GetSQLValueString($_POST['image3'], "text"),
                       GetSQLValueString($_POST['image4'], "text"),
                       GetSQLValueString($_POST['image5'], "text"),
                       GetSQLValueString($_POST['image6'], "text"),
                       GetSQLValueString($_POST['image7'], "text"),
                       GetSQLValueString($_POST['image8'], "text"),
                       GetSQLValueString($_POST['image9'], "text"),
                       GetSQLValueString($_POST['image10'], "text"),
                       GetSQLValueString($_POST['image1Big'], "text"),
                       GetSQLValueString($_POST['image2Big'], "text"),
                       GetSQLValueString($_POST['image3Big'], "text"),
                       GetSQLValueString($_POST['image4Big'], "text"),
                       GetSQLValueString($_POST['image5Big'], "text"),
                       GetSQLValueString($_POST['image6Big'], "text"),
                       GetSQLValueString($_POST['image7Big'], "text"),
                       GetSQLValueString($_POST['image8Big'], "text"),
                       GetSQLValueString($_POST['image9Big'], "text"),
                       GetSQLValueString($_POST['image10Big'], "text"),
                       GetSQLValueString($_POST['engineSubCatID'], "int"));

  mysql_select_db($database_adsCyprus, $adsCyprus);
  $Result1 = mysql_query($updateSQL, $adsCyprus) or die(mysql_error());

  $updateGoTo = "updateRecordProductsConfirmation.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
    $updateGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $updateGoTo));
}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of MichaelT_
MichaelT_
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial