2014-04-08 28 views
0

我知道這個話題在很多問題上都得到了處理,但是我找不到解決方案。 我已閱讀並嘗試了很多主題,(如12),但似乎沒有任何工作在我的頁面上。 回聲總是返回0(同時該數據爲40)錯誤回聲計數

這裏是我的代碼:

$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); 
} 

對不起,重複的條目,但我不發現錯誤 附:對不起,我的英語不好

+0

你有註釋你的SQL連接。這是這條線「#$ topics = mysql_query($ BIS);」 – user3454436

+0

這很簡單的另一個嘗試 – Lele

回答

1

您還沒有查詢運行嘗試運行與mysql_query()嘗試

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

$topics= mysql_query($BIS); 

while($row = mysql_fetch_array($topics)){ 

或嘗試count行

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

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

相同的結果,回聲0 – Lele

+0

請檢查更新的答案 –

+0

感謝您的答案。 width: $ BIS =「SELECT * FROM Voti WHERE sito ='$ sito'AND utente ='$ utente'」; $ topics = mysql_query($ BIS); $ count = mysql_num_rows($ topics); echo $ count; 郵票有史以來0 – Lele