I have the following function:
public function detail($detail, $table, $column, $value) {
        if(is_array($detail)) {
            $data = array();
            foreach($detail as $key) {
                $stmt = $this->mysqli->prepare("SELECT `$key` FROM `$table` WHERE `$column` = ?");
                if(is_numeric($value)) {
                    $stmt->bind_param('i', $value);
                } else {
                    $stmt->bind_param('s', $value);
                }
                $stmt->execute();
                $stmt->bind_result($detail);
                $stmt->fetch();
                $data[] = $detail;
            }
            return $data;
        } else {
            $stmt = $this->mysqli->prepare("SELECT `$detail` FROM `$table` WHERE `$column` = ?");
            if(is_numeric($value)) {
               $stmt->bind_param('i', $value);
            } else {
                $stmt->bind_param('s', $value);
            }
            $stmt->execute();
            $stmt->bind_result($detail);
            $stmt->fetch();
            return $detail;
        }
    }
This functions works well untill I use an array. The way to use this function is something like this: $db->detail('username', 'users', 'id', 1) This would return the username from users where the id is 1 (this works fine). Like I said the problem starts when I use an array so for example:
$details = array('username', 'active', 'registered');
$details = $db->detail($details, 'users', 'id', 1);
print_r($details);
The error is pointing to  $stmt->bind_param('i', $value); in the if(is_array()). I already tried the answer of: bind_param on a non-object but that didn't help me; I still get the same error.
I hope someone knows how to fix the Fatal error: Call to a member function bind_param() on a non-object error for me. 
Thanks in advance.
 
     
     
    