I have 2 PHP scripts : opendb.php and closedb.php
In opendb.php I have this code :
<?php
session_start();
$conn = mysqli_connect(................................);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
} else {
echo "DB open.";
$_SESSION['dbhandler'] = $conn;
}
?>
In closedb.php I have this code :
<?php
session_start(); $conn = $_SESSION['dbhandler']
mysqli_close($conn);
echo "DB closed";
?>
When I run opendb.php I get the expexted message "DB Open."
But when running the closedb.php , I get an error 500.
I was hoping to be able to pass the Handle, needed to operate in my database, between PHP scripts, by pushing it
into $_SESSION['dbhandler'] , and retreiving it in other scripts.
Is this possible ?
Regards,
Martin