Date: 11/04/00
- Next message: Jeffery Cann: "[phplib] oohform regexp - Bug or Documentation problem!"
- Previous message: Nicolaus Meins: "[phplib] ODBC connection parameters"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Greetings.
I want to build an array of arrays. Each row in the array is an
associative array with the form:
"label" => "text label", "value" = number
This array is used by the PHPlib OOH Form to build a select list. Here
is an example:
$o = array(
array("label"=>"Please Select","value"=>0),
array("label"=>"Apple","value"=>1),
array("label"=>"Orange","value"=>2),
array("label"=>"Pear","value"=>3),
array("label"=>"Grape","value"=>4)
);
I want to fill in the 'text label' and number for each row from a
database query (interbase). If I use the first code snippet below, I
get the labels in my select menu, but the values (i.e., the label id in
my
database) is missing. This is because I have not followed the expected
array format as shown above.
$rs = array();
while ( list( $key, $value ) = ibase_fetch_row( $sth ) ) {
$rs[$key] = $value;
}
If I try something like:
$i=0;
$rs = array();
while ( list( $key, $value ) = ibase_fetch_row( $sth ) ) {
$i++;
$rs[i] = array("label"=>"$value","value"=>$key);
}
I only end up with one row in my array. It does have the value,
however.
How can I modify the second code snippet so I can transform each row of
my database query into a list of arrays?
thanks
Jeff
-- jccann [at] home [dot] com--------------------------------------------------------------------- To unsubscribe, e-mail: phplib-unsubscribe <email protected> For additional commands, e-mail: phplib-help <email protected>
- Next message: Jeffery Cann: "[phplib] oohform regexp - Bug or Documentation problem!"
- Previous message: Nicolaus Meins: "[phplib] ODBC connection parameters"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

