Currently I bulid the array of $items in my external PHP file - smth like this:
And then at some stage I include some template file that basically contains HTML plus some simple PHP code to iterate the $items array.PHP Code://...
$result = mysql_query($SQL);
$items = array();
for ($i=0; $row=mysql_fetch_row($result); $i++) {
$items[$offset++] = array($row[0], $row[1], $row[2], $row[3], $row[4]);
}
mysql_close($conn);
While it works - I am a little bit concerned (wonder), if this is a good approach? I mean - what if I put the fetch_row in the template side and close the connection as almost the last thing (since there will a little code execured after the template is included).
I have not tested this solution yet, but one thing I'd get rid like this should basically be the $items array (no need for it anymore). Some free memory - often valuable.
Any thoughts on this one?
Thank U,
- MarekS -




Bookmarks