title: how to update table after inserting in another table in php
body: <p>here is my php file...
  i want to update first table after successful insertion in second table,i am to select and insert properly but the row which i want to update is not getting updated after the data is inserted.</p>
  
  <pre><code>if($_SERVER['REQUEST_METHOD']=='POST')
      {
          $full_name=$_POST['full_name']; 
          $email_address=$_POST['email_address'];
          $contact_number=$_POST['contact_number'];
          $gender=$_POST['gender'];
          $location=$_POST['location'];
          $standard=$_POST['standard'];
          $institute=$_POST['institute'];
          $code=$_POST['code'];
  
          $sql = "SELECT * FROM activations WHERE code='$code' AND status='not used'";
          $check = mysqli_fetch_array(mysqli_query($conn,$sql));
          if(isset($check)==null)
              {
                  echo  'exist';
              }
          else
              { 
                  $sql1="INSERT INTO students(full_name, email_address, contact_number, gender, location, standard, institute)             VALUES('$full_name','$email_address','$contact_number','$gender','$location','$standard','$institute')";
              }
          if (mysqli_query($conn, $sql1)==true)
              {
                  $sql2="UPDATE activations SET status='in use' WHERE code='$code';
  
      } else {
          echo "Error updating record: " . mysqli_error($conn);
      }    
  </code></pre>
  
  <p>can any one tell me how to write this in php mysqli procedural way.</p>