我有表:計數數據
==========================================================
|id | before | after | freq | id_sentence | document_id |
==========================================================
| 1 | a | b | 1 | 0 | 1 |
| 2 | c | d | 1 | 1 | 1 |
| 3 | e | f | 1 | 1 | 1 |
| 4 | g | h | 2 | 0 | 2 |
==========================================================
我想要得到的數據的數量取決於id_sentence
和freq
所以結果必須是1 2 1 下面的代碼:
$query = mysql_query("SELECT freq FROM tb where document_id='$doc_id' ");
while ($row = mysql_fetch_array($query)) {
$stem_freq = $row['freq'];
$total = $total+$stem_freq;
但結果仍然是錯誤的。請幫我..謝謝:)
什麼是'stem_freq'?未在表格中列出。 – Hamish
@Hamish抱歉,我編輯了它。 –
@JohnWoo依賴於'id_sentence'。 'id_sentence' 0有1個數據等 –