Re: [SMARTY] ADOdb with Smarty (and an array question throw in to boot!)

From: Date: Thu, 16 Dec 2004 16:58:06 +0000
Subject: Re: [SMARTY] ADOdb with Smarty (and an array question throw in to boot!)
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-12050@lists.php.net to get a copy of this message
Robert wrote:
Q1: Is there a faster way of doing this? while ($data = $rs->FetchRow()) {
        $surname[] = $data[0];
        $fname[] = $data[1];
        $userid[] = $data[2];
        $email[] = $data[3];
        $profile[] = $data[4];
        $position[] = $data[5];
}
Can't you fetch an associative row ?
Q2: I ran the above using $data[SURNAME] for $data[0] and it runs but I get "Use of undefined constant" errors in my logs. When I do a "print_r($data)" my structure looks like this: Array([0]=>HICKS[SURNAME]=>HICKS[1]=>ROBERT[FIRST_NAME]....) Do I need to use the arrays position number [0]? I would like to use [SURNAME] because it is easier to understand when you see the code. Robert
SURNAME is indeed an undefined constant. Put simple quotes : $data['SURNAME'] Yann

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