OO newb question....query results from a class

From: Date: Tue, 11 Feb 2003 21:30:34 +0000
Subject: OO newb question....query results from a class
Groups: php.general 
Request: Send a blank email to php-general+get-135245@lists.php.net to get a copy of this message
Hello! I am just getting going with OO stuff and I am stumped at how to pull out query results once it is part of a class. I am also using PEAR. Here is my code: class user { var $retval; function get_signin() { global $db_obj; $DateView = date("Y-m-d"); $sql = "SELECT date_format(sys_time_sign_in, '%h:%i %p') as sign_in FROM system_log WHERE sys_time_user_id='$_SESSION[valid_user]' AND sys_time_date='$DateView' AND sys_time_flag='ON'"; $result = $db_obj->query($sql); if (DB::isError($result)) die($result->getMessage()); while($rows = $db_obj->fetchRow($result, DB_FETCHMODE_ASSOC)) { $retval[] = $rows; } $retval = Array(); $retval['signin'] = $signin; return $retval; } } /* now to try to get at the var $retval */ $userinfo = new user(); echo $userinfo->get_signin(); It just returns "Array"? How do I, for lack of a better word....get to this array? Outside of a class it works great, I echo $rows['sign_in'] and it works. But this! Help! Many many thanks! Cory -- Cory Hicks <chicks@tri-intl.com> TRI-International

« previous php.general (#135245) next »