Hey all!

So two days ago, just for kicks, I thought I'd update to 5.1.0b3.

On to my problem.

I use a custom Session class to basically store my session data in MysQL.

Here's my class:

class DBSession
{
        static $dbh;
        
        function open($save_path, $session_name)
        {
                self::$dbh = new mysqli("localhost", "...", "...", "lists");
                return(true);
        }
        
        function close()
        {       
                return(true);
        }
        
        function read($id)
        {
                $query = "select session_data from sessions where session_id = 
'".$id."'";
                if(!$result = self::$dbh->query($query))
                        throw new MysqlException($this->dbh);
                if($result->num_rows == 0)
                {
                        return "";
                }
                        $row = $result->fetch_assoc();
                return $row['session_data'];
        }
        
        function write($id, $sess_data)
        {
                $clean_data = addslashes($sess_data);
*Error Here: if(self::$dbh->query("update sessions set session_data ='".$clean_data."', modtime=NOW() where id='".$id."'"))
                        return(true);
                else
                        throw new MysqlException(self::$dbh);
        }
        
        
        function destroy($id)
        {
        if(self::$dbh->query("delete from sessions where session_id = '$id'"))
                return(true);
        else
                return(false);
        }
        
        function gc($maxlifetime)
        {
                $ts = time() - $maxlifetime;
if(self::$dbh->query("delete from sessions where modtime < from_unixtimestamp($ts)"))
                        return(true);
                else
                        return(false);
        }
}

And the error I get is "Warning: Couldn't fetch mysqli in <the file at the line that starts with a *"

This works in 5.0.4. I haven't changed a thing and been beating myself against a wall trying to figure this out. Did something change in 5.1 that I should know about?

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to