0
這是我遇到的問題。單獨計數並提取每個數字並計算每個數字在數據庫中出現的次數
我的表有作爲列MSISDN,我想指望單獨提取每個號碼並計算每個號碼出現的次數 然後在表中顯示它的具體數量和它發生的次數,如
Number(MSISDN) | No of times
這是我的代碼,我有庫存,因爲我不知道要採取什麼步驟或如何從我的位置移動。
$go=mysql_query("SELECT * FROM request_from");
$go2=mysql_fetch_array($go);
$i=0;
while($go2=mysql_fetch_array($go))
{
$i++;
$tel=$go2['msisdn'];
//counting number of time each number occurs
$xtt=mysql_query("SELECT * FROM request_from WHERE msisdn='$tel'");
$xtt2=mysql_fetch_array($xtt);
$g=1;
while($xtt2=mysql_fetch_array($xtt))
{
$g++;
}
echo $tel occurs $g times; //for all the phone numbers, it displays the number of time each number occurs
請發表完整的代碼.. – learner
是計取一個動詞? – Strawberry