Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $sql = "SELECT t.Ativo, t.Nome, t.Idade
- FROM tabela t
- WHERE t.Id = :id";
- $consulta = $this->bd->prepare($sql);
- $consulta->bindValue(":id", 3, PDO::PARAM_STR);
- $consulta->execute();
- $registros = $consulta->fetchAll();
- if (count($registros) > 0) {
- $this->objeto = $registros[0];
- }
- function __construct($dsn, $username=null, $password=null, $driver_options=null) {
- $driver_options = array(PDO::ATTR_STRINGIFY_FETCHES => false);
- $this->db = new PDO($dsn, $username, $password, $driver_options);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement