Solved

Oracle Session Management

Posted on 2003-12-09
2
987 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
2 Comments
 
LVL 1

Accepted Solution

by:
Rayni earned 250 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

776 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