extracting data from mysql database
| From: | Blue Presley | Date: | Fri, 12 Apr 2002 00:47:26 +0000 |
| Subject: | extracting data from mysql database | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-3655@lists.php.net to get a copy of this message | ||
I appreciate the help with my earlier question.. however after trying them all at least twice, none
seemed to work. I'm sure it's something I'm doing (or not doing). Here is what
I'm trying to do: Pull data from mysql using mysql_fetch_array() and then, using smarty, put
that information into a <SELECT>menu.
this is the code in my .php file:
$sql = "select catId, category from categories";
$result = mysql_query($sql);
while($row = mysql_fetch_array($result))
{
$smarty->assign("ids",$row["catId"]);
$smarty->assign("cats",$row["category"]);
}
is this right?
here is the Smarty code in my template:
<select name="categories">
{html_options values=$ids output=$cats}
</select>
thanks again,
blue