note 95352 added to mysqli-stmt.bind-result
| From: | DavidBE at osu1 dot php dot net | Date: | Mon, 28 Dec 2009 21:27:05 +0000 |
| Subject: | note 95352 added to mysqli-stmt.bind-result | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-164404@lists.php.net to get a copy of this message | ||
I dont really see the point on using bind_param and methods as such if what you want is to get all
the data as an array.
$this->conn = new mysqli ( $db['host'], $db['username'],
$db['password'], $db['name'] );
$result = $this->conn->query( $queryStr );
while ( $row = $result->fetch_array() )
$this->result[] = $row;
And there you go: you have as an array the query. I havent checked it, but you get the idea and it
should work. The pros are that you can access all the data like an array. The cons is that you have
to extract all the data from the query.
Oh, wait. That is not a con. When you make an sql statement, you MUST gather from the database ONLY
the information you need. Nothing more, nothing less. So if you are going to extract to an array the
information of a query, then you must assume you are going to use all the data gathered. If you
dont, perhaps you should check you SQL programming abilities and do whatever you want to do with PHP
directly on the database.
At some point in the path you get obfuscated with using these functions, and perhaps they are not
the ones you need to use for your needs.
----
Server IP: 130.206.1.5
Probable Submitter: 81.39.133.77
----
Manual Page -- http://www.php.net/manual/en/mysqli-stmt.bind-result.php
Edit -- https://master.php.net/note/edit/95352
Del: integrated -- https://master.php.net/note/delete/95352/integrated
Del: useless -- https://master.php.net/note/delete/95352/useless
Del: bad code -- https://master.php.net/note/delete/95352/bad+code
Del: spam -- https://master.php.net/note/delete/95352/spam
Del: non-english -- https://master.php.net/note/delete/95352/non-english
Del: in docs -- https://master.php.net/note/delete/95352/in+docs
Del: other reasons-- https://master.php.net/note/delete/95352
Reject -- https://master.php.net/note/reject/95352
Search -- https://master.php.net/manage/user-notes.php