This is my MySQL query:
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
It takes 0.008 seconds when on a MySQL database directly.
However, when I get the results in PHP, if I use
$result = mysql_query($sql, $this->svr_msconnect);
mysql_fetch_array($result, MYSQL_ASSOC));
it takes 4 seconds to load!
Whereas, when I use
$result = mysql_query($sql, $this->svr_msconnect);
mysql_fetch_row($result);
it takes the regular 0.008 seconds or so.
As far as I know, the con of mysql_fetch_row is that it doesn’t give the name of the columns. Is that right? That would mean that I would not be able to echo something like $r['col_name'] but would instead have to use something like $r[0][3]. Is that right?
What alternatives are there?