Hello, I am trying to transfer a database connection between two pages. The connection is passed to the controller through the session variable. The connection is functioning successfully until the user refreshes the page a second time. After the second page refresh, the static variable $instance starts to return NULL. How to save its value, regardless of the number of page reloads?
<?php class Controller_upload extends Controller { private static $instance = null; function __construct() { $this->model = new Model_Upload(); $this->view = new View(); self::$instance=$_SESSION['dbase_conn']; } public static function getInstance() { if (null === self::$instance) { self::$instance = new self(); } return self::$instance; } private function __clone() {} function action_index() { if(isset($_SESSION['dbase_conn'])) { unset($_SESSION['dbase_conn']); } $data=self::$instance; $this->view->generate('upload_view.php', 'upload_template_view.php',$data); } } ?>