src/Mysql.php
public function load(int $id)
    {
        $sql = "SELECT * FROM `".$this->tableName."` "
            . "WHERE `".$this->primaryKey."` = '".$id."'"
            . "LIMIT 0,1;";
        $stmt = $this->db->query($sql);
        
        try {
            $row = $stmt->fetch(PDO::FETCH_ASSOC);
        } catch (Exception $ex) {
            $this->log->crit('Could not find requested entry in mySQL: '.$sql."\n".$ex->getMessage());
        }
        
        if (!is_array($row)) {
            return;
        }
        
        $this->loadWithData($row);
    }
public function load(int $id)
    {
        $sql = "SELECT * FROM `".$this->tableName."` "
            . "WHERE `".$this->primaryKey."` = '".$id."'"
            . "LIMIT 0,1;";
        $stmt = $this->db->query($sql);
        
        try {
            $row = $stmt->fetch(PDO::FETCH_ASSOC);
        } catch (Exception $ex) {
            $this->log->crit('Could not find requested entry in mySQL: '.$sql."\n".$ex->getMessage());
        }
        
        if (!is_array($row)) {
            return;
        }
        
        $this->loadWithData($row);
    }
public function load ( int $ id ) { $ sql = "SELECT * FROM `" . $ this -> tableName . "` " . "WHERE `" . $ this -> primaryKey . "` = '" . $ id . "'" . "LIMIT 0,1;" ; $ stmt = $ this -> db -> query ( $ sql ) ; try { $ row = $ stmt -> fetch ( PDO :: FETCH_ASSOC ) ; } catch ( Exception $ ex ) { $ this -> log -> crit ( 'Could not find requested entry in mySQL: ' . $ sql . "\n" . $ ex -> getMessage ( ) ) ; } if ( ! is_array ( $ row ) ) { return ; } $ this -> loadWithData ( $ row ) ; }
Load specific entry from DB
@param int $id primary key
@return void
Load specific entry from DB