title: bind parameters in prepared statements
body: <p>I found out earlier today that I am quite behind with using prepared statements. I tried to make a prepared statement to get some data out from my database. </p>
  
  <p>I would like to print all the rows in my database, but I am not quite sure how to do that in my while loop?</p>
  
  <pre><code>&lt;?php
  
      /* Prepare */
      if ($stmt = $mysqli-&gt;prepare("SELECT * FROM stores")) {
          echo "Prepare failed: (" . $mysqli-&gt;errno . ") " . $mysqli-&gt;error;
      }
  
      /* Bind and execute */
      $id = null;
      $headline = null;
      $description = null;
      $place = null;
      if (!$stmt-&gt;bind_param("i", $id, "s", $headline, "s", $description, "s", $place)) {
          echo "Binding parameters failed: (" . $stmt-&gt;errno . ") " . $stmt-&gt;error;
      }
  
      if (!$stmt-&gt;execute()) {
          echo "Execute failed: (" . $stmt-&gt;errno . ") " . $stmt-&gt;error;
      }
  
      while ($stmt-&gt;fetch()) {
          /* Loop through my rows in MySQL and print all rows*/
          echo $id, $headline, $description,$place;
      }
  
      /* Close Statement */
      $stmt-&gt;close();
  
      /* Close Connection */
      $mysqli-&gt;close();
  
  ?&gt;
  </code></pre>