I use the following code: $db1 = new Sql(); $sSQL = "CALL insert_user ('".$_REQUEST['username']."','".$_REQUEST['password']."','".$_REQUEST['email']."','".$_REQUEST['bcountry']."','".$_REQUEST['ncountry']."',0);"; $rc = $db1->data($sSQL); // set session values for userid, email and username $_SESSION['userid'] = $rc->insertid; $_SESSION['username'] = trim($_REQUEST['username']); $_SESSION['email'] = trim($_REQUEST['email']); sql is a new class that uses mysqli like the code below: class Sql extends mysqli { function __construct() { // eventually user-password information should be read from a file outside public_html directory parent::__construct("localhost", "username", "password", "dbname"); } function data($SQL, $force=0) { static $holdQuery; static $result; if ($SQL != $holdQuery) { $result = $this->query($SQL) or print $this->error; $holdQuery = $SQL; } return $result; } PROBLEM: The stored procedure when run from mysql returns the value of insertid - but does not return or store it into the session variable userid above on the next page. The other session variables(username and email) do return a value on next page so i dont know whats wrong - please help. Thanks.
Sorry for not using the tags. But this is my whole code. The class is called within a php page. That php page is included in the calling page and the class is initialized as db1. There is a statement in the stored procedure select LAST_INSERT_ID() as insertid; which returns a value when i execute it from mysql - but does not return a value here .... Here is the code again - with the php tags $db1 = new Sql(); $sSQL = "CALL insert_user ('".$_REQUEST['username']."','".$_REQUEST['password']."','".$_REQUEST['email']."','".$_REQUEST['bcountry']."','".$_REQUEST['ncountry']."',0);"; $rc = $db1->data($sSQL); // set session values for userid, email and username $_SESSION['userid'] = $rc->insertid; $_SESSION['username'] = trim($_REQUEST['username']); $_SESSION['email'] = trim($_REQUEST['email']); sql is a new class that uses mysqli like the code below: class Sql extends mysqli { function __construct() { // eventually user-password information should be read from a file outside public_html directory parent::__construct("localhost", "username", "password", "dbname"); } function data($SQL, $force=0) { static $holdQuery; static $result; if ($SQL != $holdQuery) { $result = $this->query($SQL) or print $this->error; $holdQuery = $SQL; } return $result; } PHP: