if (!($link = mysql_pconnect($dbHostName, $dbUserName, $dbPassword))) { return
if (!($link = mysql_pconnect($dbHostName, $dbUserName, $dbPassword))) { return null; } Select the MySQL database which contains the Session table: // select mysql database if (!mysql_select_db($dbName)) { return null; } Make the SELECT statement for retrieving the row containing data of the session: // SELECT Statement $selectStmt = “SELECT data FROM Session WHERE id = ‘” . $id . “‘”; Execute the MySQL query: // Execute the query if (!($result = mysql_query($selectStmt, $link))) { return null; } Fetch the row from the result of the query. If there was no row corresponding to the session then return null: if (($row = mysql_fetch_array($result, MYSQL_NUM))) { $data = $row[0]; } else { $data = null; } Free the MySQL result object: mysql_free_result($result); Return the session data: return $data; } The function write() stores the session data in the Sessiontable. The argument $id is the session identifier and the argument $data is the session data: function write($id, $data) { global $dbHostName, $dbUserName, $dbPassword, $dbName; Get a persistent database connection and select the MySQL database: Page 558
Note: If you are looking for best hosting provider to host and run your tomcat application check Astra tomcat hosting services