title: Active and Inactive
body: <p>Hello i have code for active and inactive image which is link to a database tables filed called status.</p>
  
  <p>Now when ever i m clicking to active or Inactive a record so its not working.</p>
  
  <p>Here is the code:</p>
  
  <p>index.php</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;&lt;/title&gt;
          &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
      &lt;/head&gt;
      &lt;body&gt;
  &lt;?PHP
  
  $user_name = "root";
  $password = "";
  $database = "tariq";
  $server = "localhost";
  
  $db_handle = mysql_connect($server, $user_name, $password);
  $db_found = mysql_select_db($database, $db_handle);
  
  if ($db_found) {
  
  $SQL = "SELECT * FROM active";
  $result = mysql_query($SQL);
  
  while ( $db_field = mysql_fetch_assoc($result) ) {
  
  if($db_field['status'] == 'Active')
  {
      echo "&lt;a href='activate.php?status= Inactive' &gt;&lt;img src =  'inactive.jpg' /&gt;&lt;/a&gt;";
  }
  else
  {
          echo "&lt;a href='activate.php?status= Active' &gt;&lt;img src =  'active.jpg' /&gt;&lt;/a&gt;";
  }
  }
  
  mysql_close($db_handle);
  
  }
  else {
  
  print "Database NOT Found ";
  mysql_close($db_handle);
  
  }
  
  ?&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Active .php</p>
  
  <pre><code>&lt;?php
  $status =  $_GET['status'];
  $con=mysqli_connect("localhost","root","","tariq");
  if (mysqli_connect_errno())
    {
    echo "Failed to connect to MySQL: " . mysqli_connect_error();
    }
  if($status == 'Active')
  {
      mysqli_query($con,"UPDATE `active` SET `status` = 'Inactive'");
  }
  else
  {
      mysqli_query($con,"UPDATE `active` SET `status` = 'Active'");
  }
  header('location:tariq.php');
  mysqli_close($con);
  ?&gt; 
  </code></pre>