note 90507 added to mysqli-stmt.bind-result

From: Date: Sat, 25 Apr 2009 10:31:24 +0000
Subject: note 90507 added to mysqli-stmt.bind-result
Groups: php.notes 
Request: Send a blank email to php-notes+get-153711@lists.php.net to get a copy of this message
bind_ result can also be used to return an array of variables from a function, This took me a long time to figure out, so I would like to share this. // function extracting(){ $query="SELECT topic, detail, date, tags FROM updates ORDER BY date DESC LIMIT 5 "; if($stmt = $this->conn->prepare($query)) { $stmt->execute(); $stmt->bind_result($updates[0],$updates[1],$updates[2],$updates[3]); $i=0; while($stmt->fetch()){ $i++; $name='t'.$i; $$name = array($updates[0],$updates[1],$updates[2],$updates[3]); } return array($t1,$t2,$t3,$t4,$t5,); $stmt->close(); } } ---- Server IP: 59.162.86.33 Probable Submitter: 122.161.101.82 ---- Manual Page -- http://www.php.net/manual/en/mysqli-stmt.bind-result.php Edit -- https://master.php.net/note/edit/90507 Del: integrated -- https://master.php.net/note/delete/90507/integrated Del: useless -- https://master.php.net/note/delete/90507/useless Del: bad code -- https://master.php.net/note/delete/90507/bad+code Del: spam -- https://master.php.net/note/delete/90507/spam Del: non-english -- https://master.php.net/note/delete/90507/non-english Del: in docs -- https://master.php.net/note/delete/90507/in+docs Del: other reasons-- https://master.php.net/note/delete/90507 Reject -- https://master.php.net/note/reject/90507 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#153711) next »