Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Re: [SMARTY] smarty and adodb help please
Hi.

Perhaps because you assigned to $results and not $list?

xo boots

--- Gareth Thomas <garetht@adelphia.net> wrote:
> 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}

Report this thread to moderator Post Follow-up to this message
Old Post
Boots
10-02-04 08:56 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PHP Smarty Templates archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:45 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.