note 30221 added to function.odbc-fetch-object

From: Date: Tue, 11 Mar 2003 12:28:02 +0000
Subject: note 30221 added to function.odbc-fetch-object
Groups: php.notes 
Request: Send a blank email to php-notes+get-45098@lists.php.net to get a copy of this message
my 2 cents: function data($res) { $obj = new stdClass(); $data_array = array(); if (!odbc_fetch_into($res, $data_array)) { return 0; } $num_fields = odbc_num_fields($res); for ($i = 0;$i < $num_fields; $i++) { $name = odbc_field_name($res, $i + 1); if (!$name) { return 0; } $obj->{$name} = $data_array[$i]; } return $obj; } works fine for me (PHP 4.3.1) -- http://www.php.net/manual/en/function.odbc-fetch-object.php http://master.php.net/manage/user-notes.php?action=edit+30221 http://master.php.net/manage/user-notes.php?action=delete+30221 http://master.php.net/manage/user-notes.php?action=reject+30221

« previous php.notes (#45098) next »