Pdo binding with no value

微信扫一扫,分享到朋友圈

Pdo binding with no value

the :cat_id has a value of nine and :tlk_id has a value of 3 if i enter them manually it will run with desired result but after binding them it gives me a row count of zero

prepare($sql);
    $sth->bindParam(':tlk_id',$tlk_id);
    $sth->bindParam(':cat_id',$cat_id);

    $r =  $sth->execute();
    $count = $sth->rowCount();
    echo $count;
?>

From the error:

Invalid parameter number: parameter ...

You can see that not all the parameters are processed. So maybe you can add 4 parameters in this case:

$sql = "SELECT
        .....
       WHERE
           t.category_id =:cat_id_1
       AND
           p.category_id =:cat_id_2
       AND
           t.forum_id = :tlk_id_1
       AND
           p.forum_id = :tlk_id_2
      ....
    ";

    $sth = $dbh->prepare($sql);
    $sth->bindParam(':tlk_id_1',$tlk_id);
    $sth->bindParam(':tlk_id_2',$tlk_id);
    $sth->bindParam(':cat_id_1',$cat_id);
    $sth->bindParam(':cat_id_2',$cat_id);

微信扫一扫,分享到朋友圈

Pdo binding with no value

号称0外挂的Faceit平台宣布正式上架绝地求生 吃鸡就能赢轿车

上一篇

揭秘交通大脑——BATJ技术争夺战,滴滴与高德的AI新版图

下一篇

你也可能喜欢

Pdo binding with no value

长按储存图像,分享给朋友