$body->set('news_list', $row = $connector->fetchArray($getNews));
//$row = $connector->fetchArray($getNews) will mysql_fetch_array for the $getNews query.
// $body->set('news_list',... is setting $news_list as the fetch_array for $getNews, see above
// In the template file we have a foreach, this gets the $news_list array and displays every news article:
foreach ($news_list as $item) {
echo "<li>
<a href=\"index.php?page=news&type=edit&id=".$item['news_id']."\">".$item['news_title']."</a>
<a href=\"index.php?page=news&type=delete&id=".$item['news_id']."\">(delete)</a>
</li>";
}
// So a simpler version:
foreach ($news_list as $item) {
echo $item['news_id']." ";//news_id with a space.
echo $item['news_title'];
echo "<br />";
}
// But the problem is that is outputs the first letter or number from a field in the database
// The Database:
news:
news_id
news_title
news_body
news_datatime
// There is only one entery in there:
id: 6
title: Test
body: Html tags work<br />see?
datetime: 2007-07-29 01:28:26
// So this outputs from the simpler version of foreach:
6 6 // thats news_id twice
T T // thats is the first letter of news_title
H H // thats is the first letter of news_body
2 2 // thats first number twice of datetime