php session doesn't work

General discussions related to php

Moderators: egami, macek, gesf

Post Reply
Flood
New php-forum User
New php-forum User
Posts: 23
Joined: Tue Jun 24, 2003 4:49 am

Thu Jun 26, 2003 3:37 am

Hi!

Perhaps it will not change anything, but if I were you, I would use $_SESSION instead of session_register...

Otherwise and in any case, define your variables before calling session_register...

/Flood

User avatar
Redcircle
Moderator
Moderator
Posts: 826
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA
Contact:

Thu Jun 26, 2003 3:04 pm

spotty wrote:Hello,
<?php
@session_start();
session_register('userName', 'userPermissions');
$userName = 'hallo';
$userPermissions = 'no';
?>



Usin this method you need to define the variables before you register them i.e.

Code: Select all

<?php
@session_start();
$userName        = 'hallo';
$userPermissions = 'no';
session_register('userName', 'userPermissions');
?>


As flood suggests using $_SESSION is not only easier to understand but there is less code. less code means less typing. less typing means less chance for typo's means less trouble debugging.

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 3 guests