Re: [SMARTY] ADOdb with Smarty (and an array question throw in to boot!)
| From: | Robert | Date: | Thu, 16 Dec 2004 17:36:20 +0000 |
| Subject: | Re: [SMARTY] ADOdb with Smarty (and an array question throw in to boot!) | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-12051@lists.php.net to get a copy of this message | ||
"Jonathan Chum" <jchum@aismedia.com> wrote in message
news:200412161657.iBGGvrbZ043707@dante.atlp.aismedia.com...
> What I generally do with ADOdb is:
>
> $result = $adodb->query("SELECT surname, fname FROM table");
> while (!$result->EOF)
> {
> $data[] = $result->fields;
> }
>
> $smarty->assign('data', $data);
>
> In my Smarty template, I would loop through the result set like so:
>
> <!---section name="set" loop=$data--->
> <!---$data[set].surname---> <!---$data[set].fname---> <BR>
> <!---/section--->
>
> Using $result->fields, the data pulled from the database is returned as
> associate array which is why I can call them directly in the Smarty
> template.
>
> BTW, try $data["SURNAME"] because without the quotes, PHP is interepreting
> it as a constant. Depending on the php.ini configuration, it will try to
> evaluate as a constant if you don't have the double quotes around it.
>
>
I am using Oracle9i and in Perl the data comes back as all uppercase when I
need to use it. Is it the same in PHP? In your example do I need to do
"$data[set].SURNAME"?
Robert