src/Database/Model.php
public function getOneById($id)
    {
        $id = (string)$id;

        $fields = implode(', ', $this->fields);
        $sql = 'SELECT ' . $fields . ' FROM ' . $this->table . ' WHERE ' . $this->table . '.id = :id';
        $query = $this->pdo->prepare($sql);
        $query->bindParam(':id', $id);
        $query->execute();

        return $query->fetch(PDO::FETCH_ASSOC);
    }
public function getOneById($id)
    {
        $id = (string)$id;

        $fields = implode(', ', $this->fields);
        $sql = 'SELECT ' . $fields . ' FROM ' . $this->table . ' WHERE ' . $this->table . '.id = :id';
        $query = $this->pdo->prepare($sql);
        $query->bindParam(':id', $id);
        $query->execute();

        return $query->fetch(PDO::FETCH_ASSOC);
    }
public function getOneById ( $ id ) { $ id = ( string ) $ id ; $ fields = implode ( ', ' , $ this -> fields ) ; $ sql = 'SELECT ' . $ fields . ' FROM ' . $ this -> table . ' WHERE ' . $ this -> table . '.id = :id' ; $ query = $ this -> pdo -> prepare ( $ sql ) ; $ query -> bindParam ( ':id' , $ id ) ; $ query -> execute ( ) ; return $ query -> fetch ( PDO :: FETCH_ASSOC ) ; }
Run a SELECT query by ID
@param int|string $id The id of the record you want to retrieve
@return mixed Query result
@since 1.1.4
Run a SELECT query by ID