0
這是我的MySQL查詢:
SELECT item_to_list_tb . * , item_tb . * , list_tb . *
FROM item_to_list_tb, item_tb, list_tb
WHERE item_to_list_tb.list_id =3
AND item_to_list_tb.item_id = item_tb.item_id
GROUP BY item_to_list_tb.item_id
ORDER BY item_to_list_tb.item_ord
LIMIT 0 , 30
它需要0.008秒時直接在MySQL數據庫上。
然而,當我得到的結果在PHP中,如果我使用
$result = mysql_query($sql, $this->svr_msconnect);
mysql_fetch_array($result, MYSQL_ASSOC));
它需要4秒加載!
然而,當我使用
$result = mysql_query($sql, $this->svr_msconnect);
mysql_fetch_row($result);
需要定期0.008秒左右。
據我所知,mysql_fetch_row
的con是它不給列的名稱。是對的嗎?這意味着我無法回顯$r['col_name']
之類的內容,而是需要使用類似$r[0][3]
之類的內容。是對的嗎?
還有什麼替代方法?
肯定不是mysql_fetch_array問題。你必須進行更多的調查 – 2011-02-14 18:13:24