Re: smarty and db

From: Date: Wed, 04 Aug 2004 03:10:38 +0000
Subject: Re: smarty and db
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-192666@lists.php.net to get a copy of this message
Amanda Hemmerich wrote:
ANyway, I need to change the code so that, when there are no row returned by the database, a message is displayed saying, "There are no events scheduled." or what have you. [snip]
(in the PHP page) $events = $db->getAll($sql_events, DB_FETCHMODE_ASSOC); $tpl->assign("events",$events); (in the template page) {section name=id loop=$events} <tr>
    <td class="event">
    <b>{$events[id].type}</b>: <a class="menulink"
href="{$url_prefix}/community/events/?id={$events[id].id}">{$events[id].date|date_format:"%B %e, %Y"}, {$events[id].speaker}</a><br />
        {$events[id].title}
    </td>
</tr> {/section}
{section name="id" loop=$events} ... {sectionelse} No results {/section} -- John Holmes php|architect - The magazine for PHP professionals - http://www.phparch.com

« previous php.general (#192666) next »