Welcome Guest, Not a member yet? Register   Sign In
Having problems with data persistency - or how to keep a DB connection alive?
#3

[eluser]duartix[/eluser]
[quote author="jairoh_" date="1380070109"]maybe there is some part in your code that you have destory/unset the session?[/quote]
I do have some destroying code but that is only called when the user clicks the logout button, so that's not the reason.

However I have managed to find a solution. It seems that there is an upper level of persistency. I changed my previous code to:

home controller:
Code:
$_SESSION["username"] = $_POST['username'];
$_SESSION["password"] = $_POST['password'];
$_SESSION["hostname"] = $_POST['hostname'];

database.php
Code:
$db['oracle']['username'] = $_SESSION["username"];
$db['oracle']['password'] = $_SESSION["password"];
$db['oracle']['hostname'] = $_SESSION["hostname"];

This will survive the page transition. Smile
Now what still puzzles me is why the user session data before that was lost. I didn't have any session_start statements before i started using the superglobal $_SESSION. Could that be the issue?

(EDIT) Well, I've tested it and that was it . My initial approach was correct, the only issue with it was session management. Now that I have the session_start statements (from the second approach) it 's working.


Messages In This Thread
Having problems with data persistency - or how to keep a DB connection alive? - by El Forum - 09-25-2013, 02:15 AM



Theme © iAndrew 2016 - Forum software by © MyBB