title: How Can I Assign the Results from Object Oriented Mysqli Prepared Statements
body: <p>I am trying to assign the results from a mysqli prepared statement query, but I am having trouble assigning the results to my variables.  I have tried several methods, and have confirmed that my query is running and returing data.</p>
  
  <p>Here is how I am trying to assign the results:</p>
  
  <pre><code>if ( $stmt1 = $mysqli-&gt;prepare("SELECT `email`, a.`$colname`
                                  FROM `li_appointments`.`li_appointments` AS a
                                  LEFT JOIN `lidb_users`.`login_users` AS b ON a.`created_by` = b.`username`
                                  WHERE a.`app_id` = ?
                                  LIMIT 1;")) {
      $stmt1-&gt;bind_param("s", $id);
      $return1 = $stmt1-&gt;execute();
      $stmt1-&gt;bind_result($z, $name);
          while($stmt1-&gt;fetch()) {
                 $to_email = $email;
                 $oldvalue = $$colnam;
                          }   
      $stmt1-&gt;close();
      }
  </code></pre>
  
  <p>Why are these not being assigned to the variables?</p>