title: Prepared statement using PHP
body: <p>I'm new to PHP .. I get stuck on how to transfer my sql statement to prepared statement .. The  error message that I got is that you " can't connect " .. </p>
  
  <p>My code is as the following </p>
  
  <pre><code>$connection = mysql_connect($host,$username,$password) or die ("can't connect"); 
  
  
  $select_database = mysql_select_db($db_name);
  $id = mysql_real_escape_string ($_GET ['id']); 
  
  $query = 'SELECT * from &amp;tbl_name where id=?';
  $stmt = $connection-&gt;prepare($query);
  $stmt-&gt;bind_param("d", $id);
  $stmt-&gt;execute();
  $rows=mysql_fetch_array($stmt);
  $stmt-&gt;close();
  </code></pre>