sessionWrite

Description

Writes the specified session data to the database (first tries updating, and then inserts it as a new row if that didn't work).

Syntax

bool sessionWrite (string $session_id, string $data)



Parameter $session_id

Expected type: String
Description: A valid PHP session ID



Parameter $data

Expected type: String
Description: The session data



Return value

Expected type: Boolean
Description: False if the session ID is invalid or true otherwise


Notes

  • Used as the 4th callback argument for session_set_save_handler
  • Only used when database-driven sessions are enabled
  • Attempts to update the existing session first
  • Inserts a new row if the update query didn't do anything
  • Uses an INSERT IGNORE query to ignore any possible problems
Advertisement: