getting data from inside a class

From: Date: Fri, 27 Jun 2003 21:28:12 +0000
Subject: getting data from inside a class
Groups: php.general 
Request: Send a blank email to php-general+get-153218@lists.php.net to get a copy of this message
Hey folks! I just posted this over on the PEAR list, but thought someone here might have some input. Can someone point me in the right direction with this little piece of code. This all works fine to get $num_rows or a single element in an array, but I need to get at all the actual elements in the array....like $rows["sys_id"] ...how would I do this? Do I return $results[] or $rows? It seems when I have tried this, all I get returned is "Array"... Any help would be great! Thanks, Cory class user_info { var $num_rows; var $results; function get_user_info() { global $db_obj; $sql = "SELECT sys_id, sys_time_user_id, sys_time_flag, sys_time_sign_in, sys_remote_add, sys_user_agent FROM system_log WHERE sys_time_flag = 'On' ORDER BY sys_time_sign_in DESC"; $result=$db_obj->query($sql); if (DB::isError($result)) die($result->getMessage()); /* //works to return num_rows while ($rows = $result->fetchRow(DB_FETCHMODE_ASSOC)) { $this->results[] = $rows; } //$num_rows = $result->numRows(); return $num_rows; */ //works to return 1 value $rows = $result->fetchRow(DB_FETCHMODE_ASSOC); $this->results = $rows[sys_time_user_id]; return $this->results; } } -- Cory Hicks <chicks@tri-intl.com> TRI International

« previous php.general (#153218) next »