Page 1 of 1

Another one for you guys (set sessions based on results)

Posted: Mon Sep 18, 2006 4:12 pm
by ianhull
Hi Guys,

I have another little issue here.
I am selecting some fields from the database like this

Code: Select all

include_once("connect.php");
$myuserid = $_SESSION['myuserid'];
$getnav = "SELECT userid, module, level FROM security WHERE userid='$userid'";
$getnavresult = mysql_query($getnav) or die($getnav); 

while ($row = mysql_fetch_array($getnavresult)) 
extract($row);
I now need to get each results module name and level and store them in a seperate session variable like this

Code: Select all

$_SESSION['module1'] = $row1 etc
$_SESSION['module1level'] = $row1 etc
Can anyone please point me in the right direction?

Thanks

Posted: Mon Sep 18, 2006 4:18 pm
by feyd
Use an incremented variable?

Posted: Mon Sep 18, 2006 4:23 pm
by ianhull
Hi feyd,

I am not sure what that is,

I was thinking of something like (for each) but don't know how to use that.

Can you help?

thanks

Posted: Mon Sep 18, 2006 5:02 pm
by RobertGonzalez
Try reading the manual on the looping functions (for, foreach, while, each, etc). You are the right track.