Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Oracle Session Management

Posted on 2003-12-09
2
Medium Priority
?
997 Views
Last Modified: 2013-12-03
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
Comment
Question by:catchmeifuwant
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 1

Accepted Solution

by:
Rayni earned 1000 total points
ID: 9907639
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
 
LVL 12

Author Comment

by:catchmeifuwant
ID: 9918339
Hi Rayni,

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

Cheers !!!
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question