I'm switching my project over to PDO and I'm having problems with the following code. It does NOT throw an error, but also does NOT insert into the database. I've been reading up on PDO and I've looked into DebugdumpParams(). I added $result->debugDumpParams() and the page does not load.
Do I need to use BindParam() after prepare(), before execute() to be able to debug?
public function CustomerInsert($name, $street1, $street2, $city, $state, $zip, $phone_area, $phone, $email, $notes, $leadtype, $rating, $newsletter, $frequency)
{
$q = "INSERT INTO customers VALUES('', :name , :street1 , :street2 , :city , :state , :zip , :phone_area , :phone , :email , :notes , :newsletter , :leadtype , :frequency )";
try{
$result = $this->connection->prepare($q);
$result->execute(array(':name'=>$name, ':street1'=>$street1, ':street2'=>$street2,
':city'=>$city, ':state'=>$state, ':zip'=>$zip, ':phone_area'=>$phone_area,
':phone'=>$phone, ':email'=>$email, ':notes'=>$notes, ':newsletter'=>$newsletter,
':leadtype'=>$leadtype, ':frequency'=>$frequency));
}
catch (PDOException $e)
{
throw new Exception('Connection failed: ' . $e->getMessage());
}
$result->ErrorInfo()and$this->connection->ErrorInfo()''in your INSERT - is that where the auto_number ID field is?)