Please somebody tell me where I'm wrong with this code:
For example;
I have a table "news" and 3 coloumns in it "id,date,text"..
and Here is my Template:
Code:
<table>
{section name=co loop=$news}
<tr>
<td><a href="view.php?id={$news[co][id]}">view<a></td>
<td>{$news[co][date]}</td>
<td>{$news[co][text]}</td>
<tr>
{/section}
</table>
and here is my PHP code:
<?php
require('engine/Smarty.class.php');
include("config.php");
$smarty = new Smarty;
$newsquery= mysql_query("SELECT id,date,text FROM news order by date desc limit 0,5");
while ( $newsloop= mysql_fetch_array ( $newsquery ) ) {
$smarty->assign('news',$newsloop);
}
$smarty->display('theme.tpl');
?>
But when I run this code; I get something like that: