• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1002
  • Last Modified:

Oracle Session Management

Hi Forum,

I'm using PHP 4.3.4 to connect to Oracle 9i Release 2.

I'm able to connect to the DB and work with the DB.

My problem is when I need to maintain the same session across pages.

For eg., in Page1.php, I logged into the DB and retrieved some data.From Page1.php the next possible step is to move to Page2.php to do some operations,again,on the DB.

I wanted to use the same connection I have in Page1.php and not log into the DB again in Page2.php.

BTW,Page2.php is opened when a link in Page1.php is clicked !!!

Is there a way of doing it?

Thanks a ton for your inputs ...it's my first tryst with PHP !!!
0
catchmeifuwant
Asked:
catchmeifuwant
1 Solution
 
RayniCommented:
Make a connetion script. For example make a new script called oracle_db.php this is where all your oracle connection. Then use the require function in your Page1.php & Page2.php scripts so that they each connect to the database.

require ( ' ./oracle_db.php ' );

I dont think you can make the same connection to the DB in Page1.php as you want to in Page2.php without being connected to the database. If you just wanted to obtain some information that Page1.php returns then either use cookies or sessions to obtain this information.

Page1.php w/ cookies :
// Using Cookies
setcookie ("username", $db[username]);
setcookie ("password", $db[password]);

Page1.php w/ sessions :
// Using Sessions
session_register("username");
session_register("password");

Page2.php
echo $username; // Print outs cookies or session variable username

Hope this help you.
- Daniel
0
 
catchmeifuwantAuthor Commented:
Hi Rayni,

Thanks a ton for the comments.It worked !!!

Cheers !!!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now