title: Unlink image based on url variable
body: <p>code updated!!
  I am trying to delete image from certain folder + data from database.
  so far it deletes database data, however it is no unlink'ing the image together with database data...script piece as follows :</p>
  
  <pre><code>          // echo '&lt;pre&gt;'; var_dump($row_rs_galleries);exit;
      $path=$_get[$row_rs_galleries['gallery_image']];
      $file="../uploads/gallerytitle/resized/$path";
      unlink($file);
  
  $deleteSQL = sprintf("DELETE FROM galleries WHERE gallery_id=%s",
                         GetSQLValueString($_GET['gid'], "int"));
  </code></pre>
  
  <p>echoing out array it shows:</p>
  
  <pre><code>array(4) {
    ["gallery_id"]=&gt;
    string(2) "20"
    ["gallery_name"]=&gt;
    string(9) "sdvsdvsdv"
    ["gallery_image"]=&gt;
    string(27) "resized_140959609221730.JPG"
    ["image_alt"]=&gt;
    string(8) "dsvsdvsd"
  }
  </code></pre>
  
  <p>It is deleting data from database but still not unlinking the image...Path seems to be ok, Array as well..What could be the problem?</p>
  
  <p>The whole page code here (in case i am placing unlink function in a wrong place?)</p>
  
  <pre><code>&lt;?php require_once('../Connections/conn_hell.php'); ?&gt;
  &lt;?php
  if (!function_exists("GetSQLValueString")) {
  function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
  {
    if (PHP_VERSION &lt; 6) {
      $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
    }
  
    $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  
    switch ($theType) {
      case "text":
        $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
        break;    
      case "long":
      case "int":
        $theValue = ($theValue != "") ? intval($theValue) : "NULL";
        break;
      case "double":
        $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
        break;
      case "date":
        $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
        break;
      case "defined":
        $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
        break;
    }
    return $theValue;
  }
  }
  $colname_rs_galleries = "-1";
  if (isset($_GET['gid'])) {
    $colname_rs_galleries = $_GET['gid'];
  }
  mysql_select_db($database_conn_hell, $conn_hell);
  $query_rs_galleries = sprintf("SELECT * FROM galleries WHERE gallery_id = %s", GetSQLValueString($colname_rs_galleries, "int"));
  $rs_galleries = mysql_query($query_rs_galleries, $conn_hell) or die(mysql_error());
  $row_rs_galleries = mysql_fetch_assoc($rs_galleries);
  $totalRows_rs_galleries = mysql_num_rows($rs_galleries);
  if ((isset($_GET['gid'])) &amp;&amp; ($_GET['gid'] != "")) {
      //--------------------------The unlink----------------------------------------------------------
  //echo '&lt;pre&gt;'; var_dump($row_rs_galleries);exit;
  
      $path=$_GET[$row_rs_galleries['gallery_image']];
      $file= realpath(__DIR__ . "../uploads/gallerytitle/resized/$path");
       unlink($file);
   //-----------------------------------------------End unlink
  
  $deleteSQL = sprintf("DELETE FROM galleries WHERE gallery_id=%s",
                         GetSQLValueString($_GET['gid'], "int"));
  
  mysql_select_db($database_conn_hell, $conn_hell);
  
    $Result1 = mysql_query($deleteSQL, $conn_hell) or die(mysql_error());
  
    $deleteGoTo = "../announcments.php?aid=5";
    if (isset($_SERVER['QUERY_STRING'])) {
      $deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&amp;" : "?";
      $deleteGoTo .= $_SERVER['QUERY_STRING'];
    }
    header(sprintf("Location: %s", $deleteGoTo));
  }
   ?&gt;
  &lt;?php
  mysql_free_result($rs_galleries);
  
  ?&gt;
  </code></pre>