|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
luke Smarty n00b
Joined: 04 May 2003 Posts: 4
|
Posted: Sat May 31, 2003 3:07 am Post subject: smart shortcut? |
|
|
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 |
|
sweatje Smarty Regular
Joined: 17 Apr 2003 Posts: 70 Location: Bettendorf, Iowa, USA
|
Posted: Sat May 31, 2003 1:43 pm Post subject: |
|
|
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 |
|
|
|
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
|