note 92287 added to mysqli-stmt.bind-result

From: Date: Fri, 17 Jul 2009 16:18:22 +0000
Subject: note 92287 added to mysqli-stmt.bind-result
Groups: php.notes 
Request: Send a blank email to php-notes+get-158423@lists.php.net to get a copy of this message
Took some cool code from here and made a little class for those object oriented kind of guys used like this: // execute prepared statement $stmt->execute(); $stmt->store_result(); //custom class :D bind to Statement Result mambo jambo! $sr = new Statement_Result($stmt); $stmt->fetch(); printf("ID: %d\n", $sr->Get('id') ); ///////////////////////////////// class Statement_Result { private $_bindVarsArray = array(); private $_results = array(); public function __construct(&$stmt) { $meta = $stmt->result_metadata(); while ($columnName = $meta->fetch_field()) $this->_bindVarsArray[] = &$this->_results[$columnName->name]; call_user_func_array(array($stmt, 'bind_result'), $this->_bindVarsArray); $meta->close(); } public function Get_Array() { return $this->_results; } public function Get($column_name) { return $this->_results[$column_name]; } } ---- Server IP: 201.216.232.3 Probable Submitter: 200.69.222.229 ---- Manual Page -- http://www.php.net/manual/en/mysqli-stmt.bind-result.php Edit -- https://master.php.net/note/edit/92287 Del: integrated -- https://master.php.net/note/delete/92287/integrated Del: useless -- https://master.php.net/note/delete/92287/useless Del: bad code -- https://master.php.net/note/delete/92287/bad+code Del: spam -- https://master.php.net/note/delete/92287/spam Del: non-english -- https://master.php.net/note/delete/92287/non-english Del: in docs -- https://master.php.net/note/delete/92287/in+docs Del: other reasons-- https://master.php.net/note/delete/92287 Reject -- https://master.php.net/note/reject/92287 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#158423) next »