note 104928 added to mysqli-stmt.fetch
| From: | skahinpihel at gmail dot com | Date: | Sat, 16 Jul 2011 12:27:32 +0000 |
| Subject: | note 104928 added to mysqli-stmt.fetch | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-181588@lists.php.net to get a copy of this message | ||
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++;
}
}
----
Server IP: 69.147.83.197
Probable Submitter: 176.65.96.227
----
Manual Page -- http://www.php.net/manual/en/mysqli-stmt.fetch.php
Edit -- https://master.php.net/note/edit/104928
Del: integrated -- https://master.php.net/note/delete/104928/integrated
Del: useless -- https://master.php.net/note/delete/104928/useless
Del: bad code -- https://master.php.net/note/delete/104928/bad+code
Del: spam -- https://master.php.net/note/delete/104928/spam
Del: non-english -- https://master.php.net/note/delete/104928/non-english
Del: in docs -- https://master.php.net/note/delete/104928/in+docs
Del: other reasons-- https://master.php.net/note/delete/104928
Reject -- https://master.php.net/note/reject/104928
Search -- https://master.php.net/manage/user-notes.php