PHP PDO令牌数量错误?

时间:2014-07-15 14:41:59

标签: php pdo

有人能告诉我这句话有什么问题,因为我没有看到任何错误吗?

    $PrevReleaseModel = $con->prepare("SELECT * FROM model WHERE model_name=:model_name AND model_release:model_release");
    $PrevReleaseModel->bindParam('model_name',$model_name);
    $PrevReleaseModel->bindParam('model_release',$model_release);
    $PrevReleaseModel->execute(array('model_name'=>$model_name,'model_release'=>$model_release));

我真的很困惑。

2 个答案:

答案 0 :(得分:2)

WHERE model_name=:model_name AND model_release = :model_release

你在最后一个条件下错过了一个等号。

答案 1 :(得分:1)

您可以尝试一下: -

 $PrevReleaseModel = $con->prepare('SELECT * FROM model 
                     WHERE model_name = :model_name AND 
                     model_releas = :model_releas'
            );
$PrevReleaseModel->bindParam(':model_name', $model_name, PDO::PARAM_STR);
$PrevReleaseModel->bindParam(':model_releas', $model_release, PDO::PARAM_STR);
$PrevReleaseModel->execute();