smarty and adodb help please

From: Date: Sat, 02 Oct 2004 01:46:17 +0000
Subject: smarty and adodb help please
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-11848@lists.php.net to get a copy of this message
Apologies if this question has already been asked.I am new to Smarty and I have spent most of the day trying to get this to work. I am reading the contents of a table and want to display it in a section, but I just get the message "Array $list has no entries", which I know it does if I use print_r in the PHP code. I am sure it's a minor stupidity of mine that's causing this, any help much appreciated: PHP script: <?php include("../adodb/adodb.inc.php"); include('../Smarty/libs/Smarty.class.php'); // Set template dir $smarty->template_dir = 'templates'; // Set compile dir $smarty->compile_dir = 'templates_c'; // create object $smarty = new Smarty; $db = NewADOConnection('mysql'); $db->Connect("localhost", "root", "", "test"); $results = $db->GetAll("SELECT Employee_Id, Employee_Name FROM employee"); if ($results === false) die("failed"); $smarty->assign('result',$results); $smarty->display('index.tpl'); ?> Template: <br> <b>Table Of Employees</b> <br> {section name="i" loop=$list} <b>Name: {$list[i].Employee_Name}; Id: {$list[i].Employee_Id}</b><br> {sectionelse} <b><br>Array $list has no entries</b> {/section} Gareth Thomas

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