Current location: Hot Scripts Forums » Programming Languages » PHP » Converting MySQL Row Array Data into Session Data


Converting MySQL Row Array Data into Session Data

Reply
  #1 (permalink)  
Old 09-15-04, 04:42 PM
mdaoust mdaoust is offline
New Member
 
Join Date: Sep 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Converting MySQL Row Array Data into Session Data

Hey guys...

I'm trying to convert an array that is generated from MySQL into a valid array to be used for Sessions. Any help you can give would be appreciated. Here is what I have right now...

PHP Code:

    $sql mysql_query("SELECT * FROM xxxx WHERE xxxx = '$u'");

    if(!
$sql){
        
header("Location: ".$baseURL."login.php?err=1");
        exit;
    }
    
$row mysql_fetch_array($sql); 
    foreach(
$row as $k => $v){
        
$_SESSION[$k]=$v;
    } 
I know that this doesn't work properly as the session is not being passed to another page. However, if I outright declare the elements of the Sessions array as follows:

PHP Code:

    while($row mysql_fetch_array($sql)){

        
$_SESSION['clientId'] = $row['clientId'];
        
$_SESSION['password'] = $row['password']; //etc..

    

the session passes with no problems.

Am I creating the Sessions Array improperly in the first example?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
strings in a mysql row Aesis PHP 8 08-18-04 03:33 AM
problem printing mysql data by "x rows/page" abtimoteo PHP 1 07-30-04 08:55 PM
MySQL help (converting SQL Server to MySQL) Mehre PHP 1 04-28-04 04:48 AM
linking to iframe not working :( j0d JavaScript 5 01-19-04 09:14 PM


All times are GMT -5. The time now is 01:45 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.