smarty displaying only first character from foreach

谁说我不能喝 提交于 2019-12-24 19:26:52

问题


I am just starting to use Smarty templates and have this very simple query:

   $result = mysql_query("SELECT `name`, `min_price` FROM `tblproductgroups` WHERE `hidden` != 'on' ORDER BY `order` ASC");
   $data = mysql_fetch_array($result);
   $ca->assign('products', $data);

And tempate file is like this:

{foreach from=$products key=key item=product}

{$product.name} - {$product.id}<br/>

{/foreach}

And the outcome comes out like this:

V - V
V - V
6 - 6
6 - 6

V is the first character for VPS (name) and 6 is the first character of price. How can I make Smarty to display the full information?

来源:https://stackoverflow.com/questions/19276200/smarty-displaying-only-first-character-from-foreach

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!