title: Using php to select with prepared statement and echoing the result or turning it into variable
body: <p>I'm working on a localhost project. Even though I might not need it, but while learning php and mysql I figured I should use prepared statements. I'm not quite getting through with it even though I've found some great guides online.</p>
  
  <p>What I'm looking for is simply to echo the name from my database. Later on I'd need to turn it into variable, but since I'm already stuck with this, I figured I'd ask here.</p>
  
  <pre><code>require_once "config.php";
  
  if ($link-&gt;connect_error) {
      die("Connection failed: " . $conn-&gt;connect_error);
  }
  
  if ($stmt = $mysqli-&gt;prepare("SELECT name FROM users")) {
      $stmt-&gt;execute();
      $stmt-&gt;bind_result($name);
  
      while ($stmt-&gt;fetch()) {
          echo ("$name");
      }
      $stmt-&gt;close();
  }
  $mysqli-&gt;close();
  </code></pre>