title: How to remove the fatal error when fetching an assoc array
body: <p>I am receiving a fatal error in my php/mysqli code which states that on line 46:</p>
  
  <pre><code>Fatal error: Call to undefined method mysqli_stmt::fetch_assoc() in ...
  </code></pre>
  
  <p>I just want to know how can I remove this fatal error?</p>
  
  <p>The line of code it is pointing at is here:</p>
  
  <pre><code>$row = $stmt-&gt;fetch_assoc();
  </code></pre>
  
  <p>ORIGINAL CODE:</p>
  
  <pre><code>$query = "SELECT Username, Email FROM User WHERE User = ?";
  // prepare query
  $stmt=$mysqli-&gt;prepare($query);
  // You only need to call bind_param once
  $stmt-&gt;bind_param("s",$user);
  // execute query
  $stmt-&gt;execute(); 
  // get result and assign variables (prefix with db)
  $stmt-&gt;bind_result($dbUser, $dbEmail);
  //get number of rows
  $stmt-&gt;store_result();
  $numrows = $stmt-&gt;num_rows();                                      
  
  if ($numrows == 1){
  
  $row = $stmt-&gt;fetch_assoc();
  $dbemail = $row['Email'];
  
  }
  </code></pre>
  
  <p>UPDATED CODE:</p>
  
  <pre><code>$query = "SELECT Username, Email FROM User WHERE User = ?";
  // prepare query
  $stmt=$mysqli-&gt;prepare($query);
  // You only need to call bind_param once
  $stmt-&gt;bind_param("s",$user);
  // execute query
  $stmt-&gt;execute(); 
  // get result and assign variables (prefix with db)
  $stmt-&gt;bind_result($dbUser, $dbEmail);
  //get number of rows
  $stmt-&gt;store_result();
  $numrows = $stmt-&gt;num_rows();                                      
  
  if ($numrows == 1){    
    $row = $stmt-&gt;fetch_assoc();
    $dbemail = $row['Email'];    
  }
  </code></pre>