我試圖修復一個來自PHP網頁的錯誤,控制檯返回這個錯誤:我不知道如何解決這個問題。調用一個sql請求中的布爾值的成員函數fetch()
[星期二年09月12 10點04分36秒2017] :: 1:49319 [200]:/extranet_administrateur/questionnaire.php?id_site=1422 - 調用一個成員函數fetch()方法在布爾在/用戶/neqodev/Desktop/cks-ocm-v3/extranet_administrateur/questionnaire.php上線444
<?php
while ($donnees = $req->fetch())
{
$n = $n+1;
$id_theme_question_q = $donnees['id_theme_question_q'];
$nom_FormSqlCategorie = $donnees['nom'];
$reponse = $bdd->query("SELECT * FROM question_q where id_site = $id_site and id_theme = '$id_theme_question_q' $requete_restriction");
$nbtotal = 0;
$nbrepondu = 0;
while ($donneessTotal = $reponse->fetch())
{
$nbtotal++;
if($donneessTotal['cignore']=='1' || !($donneessTotal['reponse_form']=='' ||$donneessTotal['reponse_form']==NULL)){
$nbrepondu++;
}
}
$nbnonrepondu = $nbtotal - $nbrepondu;
$pourcentage = $nbrepondu * 100/$nbtotal;
$pourcentage = number_format($pourcentage,2);
$pourcentage_arr = floor($pourcentage);
if($nbtotal==0){
$pourcentage = 100;
$pourcentage_arr = floor($pourcentage);
}
?>
謝謝! ;)
的[調用一個成員功能的非對象上]可能的複製(https://stackoverflow.com/questions/54566/call-to-a-member-function-on-a-非對象) – CBroe