So I am working on converting an old tutorial I did a while back from `mySQL` to `PDO`. This way I can better understand the concepts. I seem to of run into a wall however. The following function is giving me an error

```
function user_data($user_id, $db) {
    $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) . '`'; // !! LINE 12
        try {           
            $sql = sprintf('SELECT %s FROM members WHERE id = ?', $fields);         
            $stmt = $db->prepare($sql);
            $stmt->execute(array($user_id));
            $data = $stmt->fetch(PDO::FETCH_ASSOC);         
            return $data;           
        } catch(PDOException $e) {
            die($e->getMessage());
        }
    }
}

```

this is where I am calling the function

```
<?php 
session_start();
require 'database/connect_db.php';
require 'functions/users.php';

if (signedIn() === true) {
    $session_id = $_SESSION['id'];
    $user_data = user_data($session_id, $db, 'email', 'password', 'role', 'name', 'company', 'title', 'phone', 'address', 'city', 'zip', 'state', 'ext', 'pic');
    echo $user_data['name'];
}

?>

```

this is my error

```
Catchable fatal error: Object of class PDO could not be converted to string in C:\xampp\htdocs\core\functions\users.php on line 12

```

So more specifically this line as commented on in the function above

```
$fields = '`' . implode('`, `', $func_get_args) . '`';

```

I don't see why this line is the causing this error. I also have no idea how to fix it. Any help is appreciated.