|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
boranucleare Smarty n00b
Joined: 16 Apr 2005 Posts: 3
|
Posted: Sat Apr 16, 2005 10:03 pm Post subject: create a table with 4 columns for row, with data from db |
|
|
Hi All,
I would like to create a table from a template starting from a database.
here is my php page ...
[b]
$visualizza=new Smarty;
$visualizza->assign ('risultato',$db->get_results("SELECT * FROM team WHERE pubblica='si' ORDER BY name" ));
$visualizza->display('team.tpl');[/b]
my output had to be....like this..
<table>
<tr>
<td>data1</td>
<td>data2</td>
</tr>
<tr>
<td>data3</td>
<td>data4</td>
</tr>
</table>
I'm used to loop with foreach, but in this way I can only create a table with 1 col or 1 row (it depends from the choice I made).
Is it possible to have a table with more columns (for example 2 or 3) and a number of row depending from the records in the databases?
Please help me.
Thanks to all.
Bye |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|