title: Warning: mysqli_fetch_object() expects parameter 1 to be mysqli_result, string given in E:\xampp\htdocs\getSubCatList.php on line 9
body: <p>Please help me to find the bug in my code. </p>
  
  <p>It shows following <strong>Warning</strong> :</p>
  
  <blockquote>
    <p>mysqli_fetch_object() expects parameter 1 to be mysqli_result, string given in E:\xampp\htdocs\getSubCatList.php on line 9</p>
  </blockquote>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>&lt;?php
  $con = mysqli_connect("localhost","root","","dbname");
  $parentname = $_POST['$parentname'];
  $con-&gt;query("SET NAMES 'utf8'");
  $sql1 ="SELECT `fld_category_id` FROM `tbl_category_master` WHERE `fld_category_name` = '$parentname' limit 1";
  //$result = mysql_query($sql1);
  try{
  $value = mysqli_fetch_object($sql1);
  $cat_id= $value;}
  catch (Exception $e) { 
  
  echo $e-&gt;errorMessage(); }
  
  $sql="SELECT `fld_category_name` FROM `tbl_category_master` WHERE `fld_parent_category_id` = '$cat_id'";
   $result1=$con-&gt;query($sql);
          while($e=mysqli_fetch_assoc($result1)){
      $output[]=$e; **strong text**
      }   
  
      $con-&gt;close();
  ?&gt;
  </code></pre>