title: Call to a member function bind_result() on a non-object in ... on line 17
body: <p>I have a books database, using mysqli and prepared statements I am SELECTing all the fields in the DB bar 1.  The reason for this is the error</p>
  
  <p>Call to a member function bind_result() on a non-object in C:\xampp\htdocs\registersite\phpscripts1\mysqli11.php on line 17</p>
  
  <p>If I miss that field out I do not have any problems, as soon as I add it I get the error.</p>
  
  <p>The database itself is fairly simple, a total of 13 fields, the PK being the id.  The majority of the fields are varchar.</p>
  
  <ol>
  <li><a href="https://dl.dropboxusercontent.com/u/3833032/boolError/dbasescheme.png" rel="nofollow">png screenshot of DBase</a></li>
  <li><a href="https://dl.dropboxusercontent.com/u/3833032/boolError/books.sql" rel="nofollow">Database file link</a></li>
  </ol>
  
  <p>The database field causing the problem is a field 12, condition.  It is set as a varchar(10) but as soon as I introduce it to the SELECT statement it throws a spanner in the works throwing the error above.</p>
  
  <p>I would be grateful if someone could advise why the other fields are working fine yet this one just causes problems.</p>
  
  <hr>
  
  <p>Here is the relevant section of code. Line 17 is the <code>bind_result</code> call.</p>
  
  <pre><code>include 'connectvariables2.php';
  $conn = new mysqli(DB_HOST, DB_USER, DB_PSWD, DB_NAME) or die("error");
  
  $stmt = $conn-&gt;prepare("SELECT id, subject,section,topic,subtopic,title,publisher,authors,isbn13,isbn10,cdincluded,condition,notes FROM books ORDER BY id ASC");
  
  var_dump($stmt);
  
  $stmt-&gt;bind_result($id,$subject,$section,$topic,$subtopic,$title,$publisher,$authors,$isbn13,$isbn10,$cd,$cond,$notes);
  $stmt-&gt;execute();
  $stmt-&gt;store_result();
  </code></pre>