Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/288.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 错误回波计数_Php_Mysql_Sql_Count_Echo - Fatal编程技术网

Php 错误回波计数

Php 错误回波计数,php,mysql,sql,count,echo,Php,Mysql,Sql,Count,Echo,我知道这个话题在很多问题上都被讨论过,但我找不到解决办法。 我已经阅读并尝试了许多主题,如,但似乎没有一个适合我的页面。 当数据为40时,回显总是返回0 这是我的密码: $BIS = "SELECT COUNT(*) as count FROM Voti WHERE sito='$sito' AND utente='$utente'"; #$topics= mysql_query($BIS); #echo $topics['count']; <- this do

我知道这个话题在很多问题上都被讨论过,但我找不到解决办法。 我已经阅读并尝试了许多主题,如,但似乎没有一个适合我的页面。 当数据为40时,回显总是返回0

这是我的密码:

$BIS = "SELECT COUNT(*) as count FROM Voti 
        WHERE sito='$sito' AND utente='$utente'";

#$topics= mysql_query($BIS); 
#echo $topics['count'];    <- this doesn't work

while($row = mysql_fetch_array($BIS)){
    echo $row['count'];   <- this doesn't work
}


if($topics['count']==0){   <- ever 0
$query = " INSERT INTO `Voti` (`utente`,`sito`,`voto`) 
           VALUES ('$email','$sito', $voto)";
mysql_query($query);
}
很抱歉重复输入,但我没有找到错误
p、 很抱歉我的英语不好

您还没有运行query try to run with mysql\u query try

或者尝试计数行

$BIS = "SELECT * FROM Voti WHERE sito='$sito' AND utente='$utente'";

    $topics= mysql_query($BIS); 
$count = mysql_num_rows($topics);

您已经对sql连接进行了注释。这一行是$topics=mysql\u query$BIS;很简单,谢谢你的回答。宽度:$BIS=SELECT*FROM Voti,其中sito='$sito'和utente='$utente'$topics=mysql\u query$BIS$count=mysql\u num\u rows$topics;echo$count;如果您的查询没有返回任何行,请回显您的查询并检查条件是否匹配。我刚刚尝试过。在phpMyAdmin上查询时,它给了我40个入口,而不是编辑一个非常愚蠢的错误。。。变量名我错了-非常感谢!!
$BIS = "SELECT * FROM Voti WHERE sito='$sito' AND utente='$utente'";

    $topics= mysql_query($BIS); 
$count = mysql_num_rows($topics);