开发者

smarty send query

开发者 https://www.devze.com 2022-12-16 16:30 出处:网络
in.php while ($line = mysql_fetch_assoc($result)){ $value[] = $line; $value[\'newvalue\'] =\'223457\'; } $smarty->assign(\'view\', $value);

in .php

while ($line = mysql_fetch_assoc($result)){
$value[] = $line;
$value['newvalue'] ='223457';
}
$smarty->assign('view', $value);

in .tpl

 {section name=i loop=$view}
 {$view[i].newvalue}
 {开发者_如何学编程/section}

no output for newvalue.im newbie in smarty


You are kind of close, maybe... Anyway this is what you want. Make sure to indent your code so people can read it.

$c=0;
while ($line = mysql_fetch_assoc($result)){
   $value[$c] = $line;
   $value[$c]['newvalue'] ='223457';
   $c++;
}
$smarty->assign('view', $value);

in .tpl:

{foreach item=v from $view}
  {$v.newvalue}
{/foreach}
0

精彩评论

暂无评论...
验证码 换一张
取 消