1. I’d like to be able to fetch numeric arrays from the query result. At the moment only associative arrays are returned.
Could a function like this be added to DB_result.php?
function row_array_numeric($n = 0) {
// logic spread over three steps (can be simplified to just 1 line)
$associative_array = $this->row_array($n);
$numeric_array = array_values($associative_array);
return $numeric_array;
}
2. A function that would return only one the first value from a query result would be quite handy as well.
function result_value() {
$numeric_array = $this->row_array_numeric();
$value = $numeric_array[0];
return $value;
}
You could also add an X coordinate parameter to this function that returns $numeric_array[X] if that index exists:
function result_value($x = 0) {
$numeric_array = $this->row_array_numeric();
if (array_key_exists($x, $numeric_array)) {
$value = $numeric_array[$x];
}
else {
$value = $numeric_array[0];
}
return $value;
}
You could even go further and add an Y coordinate as well.
Anyway, these would be quite useful function in my opinion. What do you think?
