Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

smart shortcut?

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
luke
Smarty n00b


Joined: 04 May 2003
Posts: 4

PostPosted: Sat May 31, 2003 3:07 am    Post subject: smart shortcut? Reply with quote

html_options wants either
one array for option values and another of what to display for those values
or
one array that has both in the form array('value'=>'display')

does anybody have a clever shortcut for putting query results into the second type of array?

there must be an easy way when your query returns say userid's and names to prepare them for smarty without looping through the results and making a new array

any tips?
Back to top
View user's profile Send private message
sweatje
Smarty Regular


Joined: 17 Apr 2003
Posts: 70
Location: Bettendorf, Iowa, USA

PostPosted: Sat May 31, 2003 1:43 pm    Post subject: Reply with quote

using ADOdb (http://php.weblogs.com/ADOdb) as your abstraction layer

Code:
$rs = $conn->Execute('select key_col, val_col from tab');
$array = $o_rs->GetAssoc();


returns an assosiative array of key=>value

Code:
$array = $o_rs->GetArray();


will return an array of rows (key_col=>key_val, val_col=>val_value).

HTH
_________________
Jason
jsweat_php AT yahoo DOT com
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP