title: How to fix Warning: mysqli_query() expects parameter 2 to be string
body: <p>I need to echo all the experiences of <code>job_id 1</code>,
  when I execute my code it gives following error</p>
  
  <blockquote>
    <p>Warning: mysqli_query() expects parameter 2 to be string,</p>
  </blockquote>
  
  <p>here is my code,</p>
  
  <pre><code>&lt;?php include_once 'db.php'; ?&gt;
  
  &lt;form action='update.php' method='post'&gt;
      &lt;table border='1'&gt;
          &lt;?php
              $sql = mysqli_query($con,"SELECT *FROM `experience` WHERE job_id=1");
  
              $result= mysqli_query($con,$sql);
              if ($result) {
                  // The query was successful!
              }
              else {
                  // The query failed. Show an error or something.
              }
              while($row = mysqli_fetch_array($result)){
                  echo "&lt;tr&gt;";
                  echo "&lt;td&gt;&lt;input type='hidden' name='experi_id[]' value='".$row['exp_id']."' /&gt;&lt;/td&gt;";
                  echo "&lt;td&gt;Experince :&lt;input type='text' name='experi[]' value='".$row['experience']."' /&gt;&lt;/td&gt;";
                  echo "&lt;td&gt;year :&lt;input type='text' name='year[]' value='".$row['year']."' /&gt;&lt;/td&gt;";
                  echo "&lt;td&gt;job id :&lt;input type='text' name='job_id[]' value='".$row['job_id']."' /&gt;&lt;/td&gt;";
                  echo "&lt;/tr&gt;";
              }
              echo "&lt;input type='submit' name='update' value='UPDATE' /&gt;";
              mysqli_close($con);
          ?&gt;
      &lt;table&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>How do I fix the error?</p>