SV: Re: Database results example
| From: | Andreas Heintze | Date: | Sun, 25 Feb 2001 22:31:48 +0000 |
| Subject: | SV: Re: Database results example | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-224@lists.php.net to get a copy of this message | ||
This example below looked so clean, is it possible to make a similar
thing using the database abstraction in PEAR?
/Andreas
-----Ursprungligt meddelande-----
Från: mohrt@ispi.net [mailto:mohrt@ispi.net]För Monte Ohrt
Skickat: den 29 januari 2001 16:35
Till: Smarty@Lists.ispi.net
Kopia: Smarty@lists.ispi.net
Ämne: [smarty] Re: Database results example
Here is how one example might look using a mysql class (code untested):
index.php:
----------
<?php
require("Smarty.class.php");
require("MySQL.class.php");
$sql = new MYSQL;
$smarty = new Smarty;
// select all data as one large array $sql->query("select firstname,lastname
from users",SQL_ALL);
$smarty->assign($sql->record);
$smarty->display("index.tpl");
?>
index.tpl:
----------
<HTML>
<BODY>
{section name=userinfo loop=$firstname}
{$userinfo/firstname} {$userinfo/lastname}<br>
{/section}
---<BR>
You are currently subscribed to smarty as: andreas.heintze@home.se<BR>
To unsubscribe send a blank email to $subst('Email.Unsub')
</BODY>
</HTML>
Pablo Martinez wrote:
>
> Does anyone have an example of how to display the results of a database
> query?
>
> ---
> You are currently subscribed to smarty as: monte@ispi.net
> To unsubscribe send a blank email to $subst('Email.Unsub')
--
Monte Ohrt <monte@ispi.net>
http://www.ispi.net/