title: Allow users to delete their own comment PHP
body: <p>I want to allow my users to delete their own comments from a database via a link. However the issue I'm having is that my comment doesn't delete and I'm not given any error messages.</p>
  
  <p>This is the link to my "deletepost.php" page in my "salonpage.php":</p>
  
  <pre><code>if ($row['userID'] == $_SESSION['userID']){
  $str_comments .=" &lt;p&gt;&lt;a href='deletepost.php?pID=".$row['ID']."&amp;salonid=$salonid'&gt;Delete comment&lt;/a&gt;";
  </code></pre>
  
  <p>And this is the code in my "deletepost.php" page:</p>
  
  <pre><code>&lt;?php
    require_once("checklog.php");
    require_once("nifunctions.php");
  
    $postID = trim($_GET['pID']);
  
    if ($postID != '' &amp;&amp; is_numeric($postID))
    {
        if (!$db_server)
         {
          die("unable to connect to database: ".mysqli_connect_error($db_server));
         }
         else
         {
           $_GET['salonid'] and ($_GET['salonid'] != '');
           $salonid = clean_string($db_server, $_GET['salonid']);
  
           mysqli_select_db($db_server, $db_database) or die ("couldnt find database");
  
           //Delete post from comments
           $query= "DELETE FROM comments WHERE ID=$postID";
           mysqli_query($db_server,$query) or 
           die("comment delete failed" . mysqli_error($db_server));
  
           //redirect back to index page
           header("Location: salonpage.php?salonid=$salonid");
  
         }
         //db close
         mysqli_close($db_server);
     }
  ?&gt;
  </code></pre>