$connect = new PDO(
"mysql:host=$host;dbname=$db",
$user,
$pass,
array(
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"
)
);
https://github.com/panique/pdo-debug
<?php
$stmt=$pdo->prepare("INSERT INTO orders (id, customer, address, email) VALUES (null, :customer, :address, :email)");
$stmt->bindValue(':customer', $_POST['customer'], PDO::PARAM_STR);
$stmt->bindValue(':email', $_POST['email'], PDO::PARAM_STR);
$stmt->bindValue(':address', $_POST['address'], PDO::PARAM_STR);
$stmt->execute();
$id =$pdo->lastInsertId();
echo $id;