From d768f7ef6cfe9217ced8d0283f507c9646e1ba65 Mon Sep 17 00:00:00 2001 From: Neil Blakey-Milner Date: Mon, 3 Jan 2005 09:34:42 +0000 Subject: [PATCH] autoInsert returns the ID of the inserted row, not success. Use PEAR::isError to determine failure. --- lib/session/Session.inc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/session/Session.inc b/lib/session/Session.inc index d86ccbb..06163d4 100644 --- a/lib/session/Session.inc +++ b/lib/session/Session.inc @@ -32,7 +32,7 @@ class Session { * @param int the id of the user to create a session for * @return string the generated sessionID */ - function create($iUserID) { + function create($iUserID) { global $default; session_start(); @@ -58,12 +58,11 @@ class Session { ); $result = DBUtil::autoInsert($default->sessions_table, $aParams); - if($result != DB_OK) { - die("$lang_err_sess_write"); + if (PEAR::isError($result)) { + die("Error creating session: " . $result->toString()); } - - return $sessionID; - } + return $sessionID; + } /** * Destroys the current session. -- libgit2 0.21.4