// Get a persistent Connection if (!($link =
// Get a persistent Connection if (!($link = mysql_pconnect($dbHostName, $dbUserName, $dbPassword))) { return false; } // select mysql database if (!mysql_select_db($dbName)) { return false; } Prepare the REPLACE statement for storing the session data. If there exists a row with $id as the value of its id column, then the REPLACE statement deletes the previous row and inserts the new row with the new values, otherwise it inserts a new row: // REPLACE Statement $replaceStmt = “REPLACE INTO Session(id, data) VALUES (’$id’, ‘$data’)”; Execute the query: // Execute the query if (!($result = mysql_query($replaceStmt, $link))) { return false; } return mysql_affected_rows($link); } The function destroy() deletes the row corresponding to the session whose identifier is $id: function destroy($id) { global $dbHostName, $dbUserName, $dbPassword, $dbName; // Get a persistent Connection if (!($link = mysql_pconnect($dbHostName, $dbUserName, $dbPassword))) { return false; } // select mysql database if (!mysql_select_db($dbName)) { return false; } Prepare the DELETE statement for deleting the row with $id as the value of id column: // DELETE Statement $deleteStmt = “DELETE FROM Session WHERE id = ‘$id’”; Page 559
Note: If you are looking for cheapest and affordable webspace to host and run your servlet application check Astra j2ee hosting services