title: PHP mysqli_fetch_array() OOP style
body: <p>I want to run a SELECT query and fetch data as <code>associative array</code> and echo the fetched data.
  In procedural style I would use <code>mysqli_fetch_array()</code>. But I am now trying <code>OOP style</code>. </p>
  
  <p>I have tried this code:</p>
  
  <pre><code>$con=  new mysqli('localhost','root','','afiliate');
  $query="SELECT * FROM product WHERE ID=? ";
  $stmt-&gt;bind_param("i",$ID); /* $ID has a value, it's ok */
  $stmt-&gt;execute();
  $result=$con-&gt;query($query);
  while($row=$result-&gt;fetch_row()){
      echo $row['name'];
  }
  </code></pre>
  
  <p>And the error I get is:</p>
  
  <blockquote>
    <p>Fatal error: Call to a member function fetch_row() on boolean in /opt/lampp/htdocs/afiliate/product_details_individual.php on line 18</p>
  </blockquote>
  
  <p>How can I <strong>fetch data and echo them</strong>?</p>