This is what I found and use. I've removed my code so you can just put yours into the event functions:
Save it as a file and simply include it into your script BEFORE calling session_start() but after opening your database connection. You'll also need yourself a table for your sessions (named sessions would be sensible) and at least two columns - one for serialized data and one for the session id. Just including the file will do everything you need automatically so the moment you call session_start(), it will read out from the database (once you've written that code in) and make everything available in the $_SESSION array as normal.
function open($savePath, $sessionName)
$this->savePath = $savePath;
$this->sessionName = $sessionName;
function write($id, $data)
$handler = new FileSessionHandler();
// the following prevents unexpected effects when using objects as save handlers
The gc function is for garbage collection. You probably don't want that but if you did and you had a date column you could delete session records that were over a year old etc.