title: Display and Delete data from database
body: <p>I am new to PHP and just wanting to make a basic page where i can see all the users in the database and delete them. I have come this far but it keeps on telling me that I have an i have and Undefined index: user_id and although it tells me that it has deleted the fields it has not deleted anything. Here is my code:</p>
  
  <pre><code>&lt;?php include_once "includes/scripts.php"; ?&gt;
  &lt;?php include_once "includes/connect.php";?&gt;
  &lt;?php include_once "includes/cms_page_security.php";?&gt;
  &lt;div id="cms_container"&gt;&lt;br&gt;
      &lt;br&gt;
      &lt;h1&gt;MANAGE USERS&lt;img src="images/three_column_grid_line.png" alt="line"&gt;&lt;/h1&gt;
      &lt;p class="logout_btn"&gt;&lt;a href="admin_cms.php"&gt;Back&lt;/a&gt;&lt;/p&gt;
  &lt;?php
  $tbl="users"; // Table name 
  $sql = "SELECT * FROM $tbl";
  $result = mysql_query($sql, $connect);
  while($rows = mysql_fetch_array($result)){
  ?&gt;
  &lt;?php
  echo $rows['user_id'];
  echo $rows['user_name'];
  echo $rows['user_password'];  
  ?&gt; 
  &lt;a href="delete_user.php?id= &lt;? echo $rows['user_id']; ?&gt;"&gt;delete&lt;/a&gt;
  &lt;?php
  }
  ?&gt;
  &lt;?php
  mysql_close();
  ?&gt;
  &lt;/div&gt;&lt;!--cms_container--&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>The page that it should link to that deletes the query:</p>
  
  <pre><code>&lt;?php include_once "includes/connect.php";?&gt;
  &lt;?php
      $tbl="users"; 
      $user_id= $_GET ['user_id'];
      $sql="DELETE FROM $tbl WHERE user_id = '$user_id'";
      $result = mysql_query($sql, $connect);
      if($result){
          echo "Deleted Successfully";
          echo "&lt;BR&gt;";
          echo "&lt;a href='delete.php'&gt;Back to main page&lt;/a&gt;";
      }else {
          echo "ERROR";
      }
      ?&gt; 
  &lt;?php
  mysql_close();
  ?&gt;
  </code></pre>