I'm trying to convert mysql_query over to prepared statements, but it's failing silently and I'm not sure where I'm going wrong. Here's my proc.php page for a form:
$db = new PDO('mysql:host=XXX;dbname=XXX;charset=utf8', 'XXX', 'XXX');
if ($_POST['submit']) {
    $type = $_POST['type'];
    $auth1_lname = trim($_POST['auth1_lname']);
    $auth1_fname = trim($_POST['auth1_fname']);
    $today =  date("Y-m-d"); 
$stmt = $db->prepare("INSERT INTO table_base ( type , publ_date , auth1_lname , auth1_fname ) 
        VALUES (:type, :today, :auth1_lname , :auth1_fname) ");
    $stmt->bindParam(':type', $type);
    $stmt->bindParam(':today', $today);
    $stmt->bindParam(':auth1_lname', $auth1_lname);
    $stmt->bindParam(':auth1_fname', $auth1_fname);
    $stmt->execute();
    $bid = $db->lastInsertId();
    $subj_area = $_POST['subj_area'];
    $subject = 'subj_area';
    $subjs = '';
$stmt = $db->prepare("INSERT INTO table_meta (bid, key, value) VALUES (:bid, :key, :value)");
    $stmt->bindParam(':bid', $bid);
    $stmt->bindParam(':key', $subject);
    $stmt->bindParam(':value', $subjs, PDO::PARAM_STR);
    foreach($subj_area as $subjs) {
       $stmt->execute();
    }
    $geo_area = $_POST['geo_area'];
    $geograph = 'geo_area';
    $geos = '';
$stmt = $db->prepare("INSERT INTO table_meta (bid, key, value) VALUES (:bid, :key, :value)");
    $stmt->bindParam(':bid', $bid);
    $stmt->bindParam(':key', $geograph);
    $stmt->bindParam(':value', $geos, PDO::PARAM_STR);
    foreach($geo_area as $geos) {
       $stmt->execute();
    }
}   
- I'm not sure I'm even doing this right.
- I see comments elsewhere on SO that your PHP must be this tall to use PDO, but php.net's page on PDO doesn't list PHP requirements. Am I failing b/c my PHP5 host doesn't have the right drivers?
- Is there a way to add a die(mysql_error()) so at least it wouldn't be a silent failure?
 
    