Re: Session Varaible Problem
| From: | Erik Price | Date: | Thu, 21 Mar 2002 17:37:19 +0000 |
| Subject: | Re: Session Varaible Problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-89561@lists.php.net to get a copy of this message | ||
Have you made sure that the correct values are even being loaded into the session variable containers? IOW, try
echo $id;
echo $first_name;
to make sure that there is actually any value in those variables.
Erik
On Thursday, March 21, 2002, at 12:22 PM, Randy Phillips wrote:
Hi, I have tried every example of creating a session variable I could find on php.net and have had the same results with all of them. The session variables get set on the initial page but that's the only place I can access them. I am new to php so I'm sure I have just overlooked something. Here is my latest attempt. It's a simple login page that starts a session when a user successfully logs in: $connect... $sql ... list($id,$first_name) = mysql_fetch_row($sql); session_start(); if (!session_is_registered('user_id')) {---- Erik Price Web Developer Temp Media Lab, H.H. Brown pricee@hhbrown.comsession_register('user_id'); $user_id = $id; session_register('user_name'); $user_name = $first_name;} else {echo "<p>Session is set and should now be availalbe on all pages via acookie. At least that what I expected."; } Sadly, these vars are available only on this page. echo "<p>ID: $user_id"; echo "<p>Name: $user_name"; Mac OSX Apache PHP 4+ Thanks, -- Rp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php