Question : Dreamweaver PHP MySQL Session Variables

I am using Dreamweaver CS4 to build a PHP MySQL site (as I am not fluent in PHP MySQL).

I have a main Session Variable working fine from the log in username but was wondering, is it possible for the session variable to be something other than that user name?

So, for instance, on the user table, there is Username, Password and Unique ID. My current Session Variable is Username and that works fine - can I make the Session Variable Unique ID? When I try this the first page after log in loads with no information from the database.

It would be useful as that Unique ID is on other tables where username is not...

Thanks

Answer : Dreamweaver PHP MySQL Session Variables

Hi alexking,

You can add as many session variables as you want but you will need to do the assignment from code view.

A session is as simple as:

$_SESSION['whatever'] = whatever;

So if you have the recordset for the user with UniqueID in it, the following PHP assigns the variable:

$_SESSION['theUniqueID'] = $row_yourrecordset['UniqueID'];

obviously substituting the correct column and recordset names above...
Random Solutions  
 
programming4us programming4us