Solved

Oracle Session Management

Posted on 2003-12-09
2
984 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
Comment Utility
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
Comment Utility
Hi Rayni,

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

Cheers !!!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction Many web sites contain image galleries; a common design for these galleries includes a page with a collection of thumbnail images.  You can click on each of the thumbnail images to see the larger version of the image.  This is easily i…
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

772 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now