returning data from a function in a class

From: Date: Fri, 03 Jan 2003 06:40:38 +0000
Subject: returning data from a function in a class
Groups: php.general 
Request: Send a blank email to php-general+get-130063@lists.php.net to get a copy of this message
Hi there, I am totally new at classes and oop... I have never done any object oriented stuff before so I don't know if my question is a php one, a browser issue or an oop one but here goes. I am writing a class that deals with members for a site (I know there are examples on the web, I have used pieces parts from them...) and things seem to be going ok (actually better than OK, I have totally amazed myself so far). but I have one issue. I have a function in the class that returns the session ID if there is a valid session. otherwise it returns 0. This function works fine in IE6 however fails in mozilla or lynx. I have NO idea why and can't seem to figure out where to even start. I would really appreciate any advice. I have included the code snippits below. -- from class.session_logger.php ------------------ function is_logged_in() { session_start(); $this->current_session_id=session_id(); $db_vars = new db_vars; @$sql_connection = mysql_connect($db_vars->db_server, $db_vars->db_user, $db_vars->db_pass); if($sql_connection) { $db_connection = mysql_select_db($db_vars- >db_dbname, $sql_connection); $sql_query = "select sessionid from session where sessionid='$this->current_session_id'"; $query_result = mysql_query($sql_query); if($row=mysql_fetch_array($query_result, MYSQL_ASSOC)) { return $row[sessionid]; } else { return 0; } } } ------------------------------------------------------------------- ------- how I have calling this ------------------------- $session_logger = new session_logger; $session_id=$session_logger->is_logged_in(); //echos the session id in IE6, echos 0 in Mozilla ??? echo("<B> la la la $session_id</B>><br>"); --------------------------------------------------------- Thanks kenn

« previous php.general (#130063) next »