well esteban, here is the way ill do that:
[php]
$response = array();
$link = db_connect();
$result = mysql_query("SELECT * FROM news WHERE news_status LIKE 1
ORDER BY
news_date ASC");
while ($row = mysql_fetch_array($result)) {
array_push($response,$row);
}
$smarty->assign("row", $response);
$smarty->display("news.tpl");
[/php]
And your Smarty code
{secion name=news loop=$row}
Title: {$row[1]}<br>
Content: $row[2]}<br>
{/section}
i hope that this can help you!.
Carlos Castillo
-----Original Message-----
From: "Esteban Fernandez" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Date: Fri, 20 Jun 2003 11:42:45 -0400
Subject: [SMARTY] section problem
> Hi there
>
> I think this is a very basic question, but i'm newbie in Smarty, i hope
> someone can help me. I try list all the content in a table called
> "news",
> this display news of cource in the main page, well that's the main
> idea..
>
> I have this PHP code:
>
> [php]
> $link = db_connect();
> $result = mysql_query("SELECT * FROM news WHERE news_status LIKE 1
> ORDER BY
> news_date ASC");
> while ($row = mysql_fetch_array($result)) {
> $smarty->assign("row", $row);
> }
>
> $smarty->display("news.tpl");
> [/php]
>
> And my Smarty code
>
> {secion name=news loop=$row[0]}
> Title: {$row[1]}<br>
> Content: $row[2]}<br>
> {/section}
>
> The problem: i have 5 != news in the table, but the Smarty list the
> just the
> last new in 5 times!, how can i resolv this problem ?. Comments and
> suggest
> are welcome.
>
> Thanks in advanced.
>
> EF.
>
>
>
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php