title: function bind_param() on a non-object in my new code
body: <p>I am trying to change my PHP code into another secure one so I change the update.PHP page <a href="https://stackoverflow.com/questions/33560398/how-to-prevent-sql-injections-by-updating-codes/">from this</a> to that:</p>
  
  <pre><code>&lt;?php 
  require_once ('../include/global.php');
  $id=$_REQUEST['id']; 
  
    if (isset ($_POST['name'])) { 
  $name = $_POST['name']; 
  } 
  if (isset ($_POST['remarcs'])) { 
  $remarcs = $_POST['remarcs']; 
  } 
  if (isset ($_POST['test_res'])) { 
  $test_res = $_POST['test_res']; 
  } 
  if (isset ($_POST['address'])) { 
  $address = $_POST['address']; 
  } 
  
  if (isset ($_POST['date'])) { 
  $date = $_POST['date']; 
  } 
  
  if (isset ($_POST['phone_num'])) { 
  $phone = $_POST['phone_num']; 
  }
  
  if (isset ($_POST['illness'])) { 
  $illness = $_POST['illness']; 
  } 
  if (isset ($_POST['echo'])) { 
  $echo = $_POST['echo']; 
  } 
  if (isset ($_POST['pe'])) { 
  $pe = $_POST['pe']; 
  } 
  if (isset ($_POST['pmhx'])) { 
  $pmhx = $_POST['pmhx']; 
  } 
  if (isset ($_POST['pshx'])) { 
  $pshx = $_POST['pshx']; 
  } 
  if (isset ($_POST['habbits'])) { 
  $habbits = $_POST['habbits']; 
  } 
  if (isset ($_POST['occup'])) { 
  $occup = $_POST['occup']; 
  } 
  if (isset ($_POST['allergy'])) { 
  $allergy = $_POST['allergy']; 
  } 
  
  //Check file is uploaded or not 
  //if (isset($_FILES['file']['name']) &amp;&amp; $_FILES['file']['name']!='' &amp;&amp; $_FILES['file']['error']=='') {
  //$path2 = ... ; 
  //move_uploaded_file(...);
  if(is_uploaded_file($_FILES["file"]["tmp_name"]))
  {
      $path = "../uploads/".$_FILES['file']['name'];
      move_uploaded_file($_FILES["file"]["tmp_name"], $path);
          $new_path = "./uploads/".$path;
  
  }
  else{
      $new_path = $_POST['org_path'];
  //$path2 = "../uploads/".$_FILES['echo_photo']['name']; 
  }
  $sql=('UPDATE $tbl_name SET name = ?, 
  echo_files = ?, 
  remarcs = ?,
  test_res = ?, 
  date = ?, 
  address = ?, 
  phone_num = ?,
  illness = ?,
  echo = ?, 
  pmhx = ?, 
  pshx = ?, 
  habbits = ?, 
  occup = ?, 
  allergy = ?,
  pe = ?
  WHERE id = ? ');
  $stmt= $con-&gt;prepare($sql);
  $stmt-&gt;bind_param("ssssssssssssssi", $name, $path, $remarcs, $test_res, $date, $address, $phone,
  $illness, $echo, $pmhx, $pshx, $habbits, $occup, $allergy, $pe, $id);
  $stmt-&gt;execute();
  
  if($stmt-&gt;errno){
  echo "FAILURE!!! " . $stmt-&gt;error;
  }
   else { 
  header("location:update_done.php");
  }
  ?&gt;
  </code></pre>
  
  <p>Now I am getting this error:</p>
  
  <blockquote>
    <p>Fatal error: Call to a member function bind_param() on a non-object in
    So any help with this ?</p>
  </blockquote>