How to iterate in a table ...

From: Date: Sat, 11 Feb 2006 14:54:42 +0000
Subject: How to iterate in a table ...
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-13319@lists.php.net to get a copy of this message
Hi to every: I know how to iterate with elements came from array. For example this: PHP Code: ---- $query = $db->Execute("SELECT * FROM tabla"); // this return at least 10 elements $ac = array(); while ( $record = $query->fetchRow() ) { $ac[] = $record; } $tpl->assign('ac', $ac); TPL Code: --- <table widht="100%" cellpadding="0" cellspacing="1" border="0"> {foreach from=$ac item=element name=it} <tr> <td>{$element.ID}</td> <td>{$element.Name}</td> </tr> {/foreach} </table> This code repeat ten times a row with two columns. Now I need to build a table with two columns but in another way. Mean this: <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td>Element1</td> <td>Element2</td> <td>Element3</td> </tr> <tr> <td>Element4</td> <td>Element5</td> <td>Element6</td> </tr> <tr> <td>Element7</td> <td>Element8</td> <td>Element9</td> </tr> </table> Understand ? Best, -- ReynierPM 4to. Ing. Informática Linux User: #310201 El programador superhéroe aprende de compartir sus conocimientos. Es el referente de sus compañeros. Todo el mundo va a preguntarle y él, secretamente, lo fomenta porque es así como adquiere su legendaria sabiduría: escuchando ayudando a los demás...

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