Table with data:
id score inputid
1 1 1
2 4 1
3 3 1
4 1 2
5 2 2
6 3 5
7 1 6
8 1 6
while ($stmt_score->fetch())
{
if($bind_inputid == '1') $array['score'][0] += $bind_score;
if($bind_inputid == '2') $array['score'][1] += $bind_score;
if($bind_inputid == '5') $array['score'][2] += $bind_score;
if($bind_inputid == '6') $array['score'][3] += $bind_score;
}
如上所述,我想將所有結果與特定ID相加。但是由於會有更多的$ bind_inputid ID,我的問題是,如何爲自己的ID更多的結果自動聲明?在while循環中特定ID的組結果
它必須在while循環中完成,而不是使用mysql select。 PHP Lang。 Thx。
如何至少提您所使用的編程語言? – 2011-06-06 19:19:33
sry,; p,它的php – Cameleon 2011-06-06 19:21:21