所以basiacally我有一个查询,我运行并应用“ while($ item = oci_fetch_assoc($ stid))”,我很困惑如何将行分别放在一个对象中并将其传递给smarty模板并在表中显示聪明
Build the entire rowset array, then pass that to your templating engine
$rowset = array();
while($item = oci_fetch_assoc($stid)) {
$rowset[] = $item;
}
$smarty->assign($rowset); // Haven't used smarty in years, just guessing here
So basically we have to do something like : $i=1; while($row =oci_fetch_assoc($stid)){
foreach($row as $key=>$value){
$data_row[$i][$key]=$value;
}
$i++;
}
SO this way $data_row[][] will be every entry and assign it to smarty. In Smarty we will access it by : {foreach from=$row key=myid item=foo} {$foo.key1} {$foo.key2} {$foo.key3} and so on {/foreach}
or whatever ur key is
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.