note 104928 deleted from mysqli-stmt.fetch by danbrown
| From: | danbrown@php.net | Date: | Mon, 18 Jul 2011 17:06:23 +0000 |
| Subject: | note 104928 deleted from mysqli-stmt.fetch by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-181666@lists.php.net to get a copy of this message | ||
Note Submitter: skahinpihel at gmail dot com
----
My mysql_fetch_assoc on mysqli
$meta = $this->_stmt->result_metadata();
$ret = NULL;
if($meta !== false) {
$ret = array();
$cols = array();
//tnx http://www.php.net/manual/en/mysqli-stmt.fetch.php#72720
$fields = $meta->fetch_fields();
$cnt_fields = count($fields);
foreach($fields as $field) {
$cols[] = &$this->_con->results[$field->name];
}
call_user_func_array(array($this->_stmt, 'bind_result'), $cols);
$key = 0;
while($this->_stmt->fetch() != NULL) {
$num_col = 0;
foreach ($this->_con->results as $result) {
$ret[$key][$fields[$num_col]->name] = $result;
$num_col++;
}
$key++;
}
}