Welcome Guest, Not a member yet? Register   Sign In
Bring all fields at once
#1

[eluser]Unknown[/eluser]
Hi guys,
This is my first post, I'm new here and in codeigniter as well
Can someone help me with this:

I want to bring all fields at once, here is code:

Code:
$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) . '`';
   $query  = $this->db->query("SELECT $fields FROM `users` WHERE `user_id` = '$user_id'");                
  
    return $query->row_array();
}
#2

[eluser]Unknown[/eluser]
[quote author="fernandoC" date="1343360741"]Hi guys,
This is my first post, I'm new here and in codeigniter as well
Can someone help me with this:

I want to bring all fields at once, here is code:

Code:
$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) . '`';
   $query  = $this->db->query("SELECT $fields FROM `users` WHERE `user_id` = '$user_id'");                
  
    return $query->row_array();
}
[/quote]

sorry guys, I found my mistake, I was forgetting to call the key within the array in my view...

Code:
$profile_data->username;




Theme © iAndrew 2016 - Forum software by © MyBB