View Single Post
Old 10-11-2007, 05:27 PM  
Varius
Confirmed User
 
Industry Role:
Join Date: Jun 2004
Location: New York, NY
Posts: 6,890
You really shouldn't be mixing php code into your smarty templates as the whole purpose of smarty is to separate code from html.

However Smarty has no mysql functions I know of, so to do it in the template you would have to use {php}{/php} to allow you to execte php code and then use php's mysql functions like mysql_connect(), mysql_db_query(), etc...

I recommend since you are starting though to start the right way and use adoDB or another db abstraction layer class to keep things portable and clean.

Do your SQL in the php file and assign it to whatever variables you need to access it with in smarty. Don't tdo your SQL in the template.
__________________
Skype variuscr - Email varius AT gmail
Varius is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote