我試圖顯示whileloop以外的點。我正在獲取像這樣的結果。while循環後顯示結果計數
Facebook
Twitter,Facebook,Instagram,Youtube
Facebook
Facebook
它從每一行提取Facebook並最終計數次數。
<?php
$q = "select * FROM users";
$r = mysql_query($q);
$total = mysql_num_rows($r);
while($row = mysql_fetch_assoc($r)) {
$fb= $row['social'];
$dbreq = implode(',',explode(',', $fb));
$fa=array("Twitter,",",Instagram,","Youtube");
$newstring = str_replace($fa, "", $dbreq);
echo $points= count(explode(',', $newstring));
}
?>
爲什麼不使用SELECT COUNT(*)? – 2015-04-05 11:00:59
你的問題是什麼?你想要的輸出是什麼? – 2015-04-05 11:03:26
我想通過直接或修改字符串來計算Facebook中保存的facebook的次數 – Roger 2015-04-05 11:04:34