绑定变量的数量与令牌的数量不匹配-MySQl

绑定变量的数量与令牌的数量不匹配-MySQl,mysql,prepared-statement,Mysql,Prepared Statement,更好的标题可能是“我不会数数”:-( 这段代码怎么了?应该很明显,但我看不出来 if (isset($_GET['campaign_id'])) { ChromePhp::log('API: request to update existing campaign "' . $campaignTitle . '"'); $sqlCommand = $pdo->prepare('UPDATE campaigns SET title=:title, description=:de

更好的标题可能是“我不会数数”:-(

这段代码怎么了?应该很明显,但我看不出来

if (isset($_GET['campaign_id']))
{
    ChromePhp::log('API: request to update existing campaign "' . $campaignTitle . '"');
    $sqlCommand = $pdo->prepare('UPDATE campaigns SET title=:title, description=:description, start_time=:start_time, end_time:end_time) WHERE (customer_id=:customer_id) AND (campaign_id=:campaign_id)');
    $sqlCommand->bindParam(':campaign_id', $_GET['campaign_id']);
}
else
{
    ChromePhp::log('API: request to add a new campaign "' . $campaignTitle . '"');
    $sqlCommand = $pdo->prepare('INSERT INTO campaigns (customer_id, title, description, start_time, end_time) VALUES(:customer_id, :title, :description, :start_time, :end_time)');
}

$sqlCommand->bindParam(':customer_id', $customerId);
$sqlCommand->bindParam(':title', $campaignTitle);
$sqlCommand->bindParam(':description', $campaignDescription);
$sqlCommand->bindParam(':start_time', $startTimeStamp);
$sqlCommand->bindParam(':end_time', $endTimeStamp);
$sqlResult = DatabaseCommand($sqlCommand);
浏览到

http://localhost/api/addCampaign.php?customer=1&title=t&description=d&startTimeStamp=1443313713&endTimeStamp=1443313713&campaign_id=5
给出
消息:SQLSTATE[HY093]:无效参数编号:绑定变量的数量与令牌的数量不匹配

浏览器的开发者控制台日志显示
API:更新现有活动“t”的请求


谁会让我摆脱痛苦,让我说“噢!”?

这条评论有点长。我不知道你为什么会收到这条消息,但你在
更新中有这段代码:

end_time:end_time
这应该是

end_time = :end_time
也许这会解决你的问题