title: MySQLi - Right way to execute querys?
body: <p>First of all, this is my first meeting with MySQLi... I heard that MySQLi is better, but every time I wrote some code, I get</p>
  <blockquote>
  <p>Fatal error: Call to a member function bind_param() on a non-object</p>
  </blockquote>
  <p>My code is this:</p>
  <pre><code>&lt;?php
  /* Create a new mysqli object with database connection parameters */
  $m = new mysqli('localhost', 'root', '', 'mysqlisample');
  if(mysqli_connect_errno()) {
  echo &quot;Connection Failed: &quot; . mysqli_connect_errno();
  exit();
  }
  $ida=1;
  $statement = $m-&gt;prepare(&quot;SELECT * FROM post WHERE `id` =  ?&quot;);
  $statement-&gt;bind_param(&quot;i&quot;,$ida);
  $id = 0;
  $post_title = '';
  $post_content = '';
  $statement-&gt;bind_result($id,$post_title,$post_content);
  $statement-&gt;execute();
  while ($statement-&gt;fetch()){
  echo $id.' '.$post_title.' '.$post_content.'\n'; //These variables will get the values of the current row
  }
  ?&gt;
  </code></pre>
  <p>This is just one of many code sample that I read somewhere, but, none of them working.</p>
  <p>What is the right way for executing MySQLi query and print the results?</p>