connection = new Mysql(); /** Instânciamento de classes */ $this->Main = new Main(); } /** Busca genérica de registro */ public function Get(string $table, string $primaryKey, string $column, int $primaryKeyValue) : ? string { /** Parâmetros de Entrada */ $this->table = $table; $this->primaryKey = $primaryKey; $this->primaryKeyValue = $primaryKeyValue; $this->column = $column; /** Consulta SQL*/ $this->sql = "SELECT {$this->column} AS CAMPO FROM {$this->table} WHERE {$this->primaryKey} = :primaryKeyValue"; /** Preparo o SQL para execução */ $this->stmt = $this->connection->connect()->prepare($this->sql); /** Preenchimento dos parâmetros */ $this->stmt->bindParam(':primaryKeyValue',$this->primaryKeyValue); /** Executo o SQL */ $this->stmt->execute(); /** Retorno em formato de obeto */ return $this->stmt->fetchObject()->CAMPO; } /** Fecha uma conexão aberta anteriormente com o banco de dados */ function __destruct() { $this->connection = null; } }