note 124333 added to mysqli-stmt.fetch
| From: | xcyberx at protonmail dot com | Date: | Thu, 24 Oct 2019 15:52:11 +0000 |
| Subject: | note 124333 added to mysqli-stmt.fetch | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-212761@lists.php.net to get a copy of this message | ||
Not any example for result with field names is not works correct when used prepare. This is correct
variant:
<?php
// STMT SQL prepeare and execute
protected static function stmtSQL( $CONNECTION, $SQL_STMT ) {
$stmt = $CONNECTION->stmt_init();
if( $stmt->prepare($SQL_STMT) ) {
$stmt->execute();
$r = $stmt->get_result();
while ( $row = mysqli_fetch_assoc($r) ) {
print '<pre>'. print_r( $row, true ) .'</pre>';
}
...
$stmt->close();
return $result;
}
else {
return null;
}
}
?>
Then we can make modifier to make possible collect data into fields_named array when used JOIN
because it more flexible ;)
----
Server IP: 208.43.231.9
Probable Submitter: 185.85.3.168 (proxied: 31.173.100.121)
----
Manual Page -- http://php.net/manual/en/mysqli-stmt.fetch.php
Edit -- https://master.php.net/note/edit/124333
Del: integrated -- https://master.php.net/note/delete/124333/integrated
Del: useless -- https://master.php.net/note/delete/124333/useless
Del: bad code -- https://master.php.net/note/delete/124333/bad+code
Del: spam -- https://master.php.net/note/delete/124333/spam
Del: non-english -- https://master.php.net/note/delete/124333/non-english
Del: in docs -- https://master.php.net/note/delete/124333/in+docs
Del: other reasons-- https://master.php.net/note/delete/124333
Reject -- https://master.php.net/note/reject/124333
Search -- https://master.php.net/manage/user-notes.php