How do i delete the records from the table?
<p>I am using a form to get the input of username and password to store the value into the database, once the form is submitted i have defined a table to show all the values from the users table, it have 3 fields (id, name, pass) i want to delete each record by it's id . </p>

<p>i am fetching the data from the users table by using the following code:</p>

<pre><code>while($row = mysql_fetch_assoc($result_select)) {
           echo "&lt;tr&gt;";
           echo "&lt;td&gt;" . $row['id'] . "&lt;/td&gt;";
           echo "&lt;td&gt;" . $row['name'] . "&lt;/td&gt;";
           echo "&lt;td&gt;" . $row['pass'] . "&lt;/td&gt;";
           echo "&lt;/tr&gt;"; }
</code></pre>

<p>i want to add the delete hyperlink to delete the particular records by id.</p>

<p>i tried using the following code and i couldnt achieve it.</p>

<pre><code>if(mysql_num_rows($result_select) &gt; 0) {

        if(isset($_POST['id'])) {
             $query_delete = "DELETE FROM users WHERE id =" .$_POST['id']; 
             $result_delete = mysql_query($query_delete);

        }
       echo "&lt;table cellpadding=10 border=1&gt;";
        while($row = mysql_fetch_assoc($result_select)) {

           echo "&lt;tr&gt;";
           echo "&lt;td&gt;" . $row['id'] . "&lt;/td&gt;";
           echo "&lt;td&gt;" . $row['name'] . "&lt;/td&gt;";
           echo "&lt;td&gt;" . $row['pass'] . "&lt;/td&gt;";
           echo "&lt;td&gt;&lt;a href=".$_SERVER['PHP_SELF']."?id=".$row[id]."&gt;Delete&lt;/a&gt;&lt;/td&gt;"; 
           echo "&lt;/tr&gt;";
        }
  echo "&lt;/table&gt;";
    }
</code></pre>

<p>I am a newbie to programming, i would appreciate if someone explain me in simple words.. thank you :)</p>
