Re: {section} question

From: Date: Wed, 28 Feb 2001 18:55:06 +0000
Subject: Re: {section} question
References: 1 2  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-243@lists.php.net to get a copy of this message
On Wed, 28 Feb 2001, Maciek Uhlig wrote: > Yes, I definitely agree. I don't want SQL in templates. What I was thinking > of, is your beatiful simple example sent to the list in the end of January > (let me quote a part of it): > > $sql->query("select firstname,lastname from users",SQL_ALL); > $smarty->assign($sql->record); > > You used "your" database class (require("MySQL.class.php");). Is something > like that possible today using PEAR class? Here's how to do it using PEAR DB class (simplified, no error checking): $sql = DB::connect('mysql://myname:mypass;@server.net/DBNAME'); $result = $sql->getAll('select firstname, lastname from NS_sections', DB_FETCHMODE_ASSOC|DB_FETCHMODE_FLIPPED); $smarty->assign($result); -Andrei "Everything should be made as simple as possible, but not simpler." -- Albert Einstein

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