Skip to content

Latest commit

 

History

History
26 lines (21 loc) · 723 Bytes

File metadata and controls

26 lines (21 loc) · 723 Bytes

PHP JWT API

public function findFieldsById($fields,$author_id)
    {
        
        $query = 'SELECT ';
        $query .= implode(', ', $fields);
        $query .= 'FROM author WHERE author_id = :author_id';
        
        $stmt = $this->db->prepare($query);
        $stmt->bindValue(':author_id', $author_id);
        $stmt->execute();
        $result = $stmt->fetch(PDO::FETCH_ASSOC);

        if ($result) {  
            $author = new Author()          
            if (!empty($fields[''])) {

            }    
            return $result['author_id']??null, $result['name'], $result['last_name'], $result['country']);
        } else {
            return null;
        }
    }