Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

Send a query to a template

 
Post new topic   Reply to topic    Smarty Forum Index -> Smarty Development
View previous topic :: View next topic  
Author Message
mdelsaut
Smarty n00b


Joined: 16 Jul 2003
Posts: 2
Location: Rennes - France

PostPosted: Wed Jul 16, 2003 8:27 am    Post subject: Send a query to a template Reply with quote

Hello!

I'm beginner with Smarty and i want to know if is it possible to send a result of query directly in a template (and no use a array).

Like:

script :
$sql="SELECT * FROM table"
$sql_result=mysql_query($sql);
$index->assign('content', $sql_result);


tpl:
{foreach item="curr_section" from=$content}
<table>
<tr>
<td>{$curr_section.id}>/td>
</tr>
</table>
{/foreach}


Thank you!
Back to top
View user's profile Send private message Send e-mail Visit poster's website
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Wed Jul 16, 2003 10:20 am    Post subject: Reply with quote

short answer: no thats not possible. use an array.

longer answer: with many tricks and hacks this may be possible, but it is highly disencouraged. use an array.
Smile
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mdelsaut
Smarty n00b


Joined: 16 Jul 2003
Posts: 2
Location: Rennes - France

PostPosted: Wed Jul 16, 2003 12:33 pm    Post subject: Reply with quote

ok

it is well what seemed to me! Sad

thank you nevertheless
Back to top
View user's profile Send private message Send e-mail Visit poster's website
DeyV
Smarty Rookie


Joined: 01 Jul 2003
Posts: 6
Location: Poland

PostPosted: Sat Aug 16, 2003 3:40 pm    Post subject: Reply with quote

You can use ADoDB Wink
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Smarty Development All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP