using a variable to show MYSQL_BOTH in mysql_fetch_array()
Posted: Tue Jun 19, 2007 3:31 pm
feyd | Please use
Please assume everything outside of this code snippet works properly (since it does). I want to allow a way for the developer to determine what type of indices to use on the return array from a fetch.
The output from this section is:
Which brings me to my question. How come in my echo statement, I can see that $return_type is set to MYSQL_BOTH but when I try to pass that along my call_user_func() it errors saying it is not a valid type?
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hello everyone, I am writing a custom database wrapper class that will allow for connecting to multiple databases (MSSQL, MySQL, ODBC, etc).Code: Select all
if($type == 1) {//return array as both number and associative indices
$return_type = $this->db_return_both;
}
echo "HERE! : $return_type $this->db_fetch_array $this->query_id <hr>";
$row=call_user_func($this->db_fetch_array,$this->query_id,$return_type);
return $row;The output from this section is:
Code: Select all
HERE! : MYSQL_BOTH mysql_fetch_array Resource id #3
Warning: mysql_fetch_array(): The result type should be either MYSQL_NUM, MYSQL_ASSOC or MYSQL_BOTH.feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]