title: Mysqli Prepare Statement - Returning False, but Why?
body: <p>I have a function that generates a prepared INSERT statement based on an associative array of column names and values to be inserted into that column and a table name (a simple string):</p>
  
  <pre><code>function insert ($param, $table) {
          $sqlString = "INSERT INTO $table (".implode(', ',array_keys($param)).') VALUES ('.str_repeat('?, ', (count($param) - 1)).'?)';
          if ($statement = $this-&gt;conn-&gt;prepare($sqlString)):
              $parameters = array_merge(array($this-&gt;bindParams($param), $param));
              call_user_func_array(array($statement, 'bind_param', $parameters));
              if (!$statement-&gt;execute()):
                  die('Error! '.$statement-&gt;error());
              endif;
              $statement-&gt;close();
              return true;
          else:
              die("Could Not Run Statement");
          endif;
      }
  </code></pre>
  
  <p>My problem is that $this->conn->prepare (it's part of a class, conn is a NEW mysqli object, which works with no issues) returns false, but does not give me a reason why!</p>
  
  <p>Here is a sample $sqlString that gets built for the prepare statement:</p>
  
  <pre><code>INSERT INTO students (PhoneNumber, FirstName, MiddleInit, LastName, Email, Password, SignupType, Active, SignupDate) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
  </code></pre>
  
  <p>Can anyone see a problem with this parameterized statement? Any reason the prepare function would return false?</p>