note 68837 added to function.sqlite-fetch-object
| From: | florianatphpwsdotorg at osu1 dot php dot net | Date: | Sat, 12 Aug 2006 17:13:33 +0000 |
| Subject: | note 68837 added to function.sqlite-fetch-object | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-115832@lists.php.net to get a copy of this message | ||
Here is the function from "cscm at meuh dot dyndns dot org" rewriten.
I think it will work better when really assigning the values ;-)
Also I'd replace the empty "bidon" class by stdClass wich is such an empty class and
is provided by default.
// Fetch resultset as an object
function sqlite_fetch_object(&$resource){
$arr = sqlite_fetch_array($resource);
$obj = new stdClass();
foreach ($arr as $key => $value) {
# Check is valid $T_VARIABLE
if (ereg(\"[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*\", $key)) {
$obj->$key = $value;
}
}
return $obj;
}
----
Server IP: 217.13.201.10
Probable Submitter: 84.159.91.187
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.sqlite-fetch-object.php
Edit -- https://master.php.net/note/edit/68837
Del: integrated -- https://master.php.net/note/delete/68837/integrated
Del: useless -- https://master.php.net/note/delete/68837/useless
Del: bad code -- https://master.php.net/note/delete/68837/bad+code
Del: spam -- https://master.php.net/note/delete/68837/spam
Del: non-english -- https://master.php.net/note/delete/68837/non-english
Del: in docs -- https://master.php.net/note/delete/68837/in+docs
Del: other reasons-- https://master.php.net/note/delete/68837
Reject -- https://master.php.net/note/reject/68837
Search -- https://master.php.net/manage/user-notes.php