警告:PDOStatement::execute() [pdostatement.execute]: SQLSTATE[HY093]: 参数号无效:参数未定义
<?php
$firstname = $_POST['first-name'];
$lastname = $_POST['last-name'];
$company = $_POST['company'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$city = $_POST['city'];
$state = $_POST['state'];
$zip = $_POST['zip'];
$country = $_POST['country'];
$type = $_POST['type'];
$source = "IP-Demo";
// query
$sql = "INSERT INTO Contact (first-name,last-name,Company,email,phone,city,state,zip,country,type,source)
VALUES (:first-name,:last-name,:Company,:email,:phone,:city,:state,:zip,:country,:type,:source)";
$q = $conn->prepare($sql);
$q->execute(array(
':first-name'=>$firstname,
':last-name'=>$lastname,
':Company'=>$company,
':email'=>$email,
':phone'=>$phone,
':city'=>$city,
':state'=>$state,
':zip'=>$zip,
':country'=>$country,
':type'=>$type,
':source'=>$source
));