Jump to content
Larry Ullman's Book Forums

failed to fetch logged in user data


Recommended Posts

hi

i 've got  difficulty fetching currently logged in user data for display and further editing

here is my code from (users.php) or what most refer to "functions.php

function user_data($user_id) {
    $data = array();
    $user_id = (int)$user_id;
    
    $func_num_args = func_num_args();
    $func_get_args = func_get_args();
    
    if ($func_num_args > 1){
        unset($func_get_args[0]);
        
        $fields = '`' . implode('`, `', $func_get_args) . '`';
        $data = mysql_fetch_assoc(mysql_query("SELECT $fields FROM `log_in_registrar` WHERE `user_id` = $user_id"));
        
        print_r($data);
        die();
        
        return $data;
    }
}

i hope it makes some sense

regards

Link to comment
Share on other sites

What's the actual problem you're having? What errors are you seeing, if any? 

All that being said, there's kind of a lot of problems with that code from a design standpoint. Way too much undocumented magic going on. The dynamic fetching of specific fields is dubious.  

Link to comment
Share on other sites

 Share

×
×
  • Create New...