note 85659 deleted from mysqli-stmt.bind-result by felipe

From: Date: Sat, 13 Sep 2008 00:37:52 +0000
Subject: note 85659 deleted from mysqli-stmt.bind-result by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-144386@lists.php.net to get a copy of this message
Note Submitter: hamidhossain at gmail dot com ---- ok guys, my previous post had a bug! please change code as follows: <?php if ($stmt = $mysqli->prepare("SELECT * FROM sample WHERE t2 LIKE ?")) { $tt2 = '%'; $stmt->bind_param("s", $tt2); $stmt->execute(); $meta = $stmt->result_metadata(); while ($field = $meta->fetch_field()) { $params[] = &$row[$field->name]; } call_user_func_array(array($stmt, 'bind_result'), $params); while ($stmt->fetch()) { foreach($row as $key => $val) { $c[$key] = $val; } $result[] = $c; } $stmt->close(); } print_r($result); ?> This will not have the reference problem existed in my first comment. Best Wishes, Hamid

« previous php.notes (#144386) next »