title: Call to a member function bindValue() on a non-object
body: <p>So I'm trying to create a prepared insert statement to a database for a web app. For the registration system, I'm feeding in values using post, then redirecting to a webpage to do the processing. However, I keep getting the error 'Call to a member function bindValue() on a non-object in /path/to/file.php on line 18, the first reference to bindValue(). The code is:</p>
  
  <pre><code>&lt;?php
  
   session_start();
  
   require "database.php";
   $db = new Database("bills.db");
  
   $admin_password = $_POST['admin_password'];
   $admin_email = $_POST['admin'];
   $salt = sha1(time());
   $group_name = $_POST['group_name'];
   $group_password = $_POST['password'];
  
   $admin_hash = sha1($salt."--".$admin_password);
   $group_hash = sha1($salt."--".$group_password);
  
  $stmt = $db-&gt;prepare("INSERT INTO billgroup VALUES (NULL, :adminemail, :adminpassword_hash, :groupname, :password_hash, :salt)");
  $stmt-&gt;bindValue(':adminemail', $admin_email, SQLITE3_TEXT);
  $stmt-&gt;bindValue(':adminpassword_hash', $admin_hash, SQLITE3_TEXT);
  $stmt-&gt;bindValue(':groupname', $group_name, SQLITE3_TEXT);
  $stmt-&gt;bindValue(':password_hash', $group_hash, SQLITE3_TEXT);
  $stmt-&gt;bindValue(':salt', $salt, SQLITE3_TEXT);
  $results = $stmt-&gt;execute();
  
  
  
  
   $stmt = $db-&gt;prepare("SELECT * FROM billgroup WHERE adminemail = :adminemail");
   $stmt-&gt;bindValue(':adminemail', $admin_email, SQLITE3_TEXT);
   $users = $stmt-&gt;execute();
   $user = $users-&gt;fetchArray();
  ...
  </code></pre>