Re: [SMARTY] passing result arrays to Smarty template

From: Date: Wed, 12 Jan 2005 18:57:21 +0000
Subject: Re: [SMARTY] passing result arrays to Smarty template
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-12154@lists.php.net to get a copy of this message
Le 12 janv. 05, à 17:39, Kathleen Krause-Thompson a écrit :
$sql = "SELECT ORGANIZATION_ID, ORGANIZATION_NAME FROM ORGANIZATION"; $result = mysql_query($sql); while ($row = mysql_fetch_array($result)) { $smarty->assign("organizations", array("ID" => $row[0], "ORGANIZATION_NAME" => $row[1] )); }
Hello, $sql = "SELECT ORGANIZATION_ID, ORGANIZATION_NAME FROM ORGANIZATION"; $result = mysql_query($sql); $a_organizations = array(); while ($row = mysql_fetch_array($result)) { $a_organizations[$row[0]] = $row[1]; } $smarty->assign('organizations', $a_organizations); {foreach from=$organizations key=ID item=ORGANIZATION_NAME}
       {$ID}   {$ORGANIZATION_NAME} <br>
{/foreach} Bye Bertrand

« previous php.smarty.general (#12154) next »