<?php
    class ImoveisImagens{

        // Connection
        private $conn;

        // Table
        private $db_table = "imoveis";

        // Columns
        public $id;
        public $imagem;
        public $posicao;

                  
        // Db connection
        public function __construct($db){
            $this->conn = $db;
        }



            // CAPTURA IMAGENS DO IMOVEL PELO ID DO IMOVELSA
            public function getImovelImagensID(){
                
                $itemID = (int)$this->id;
                $sqlQuery = "
                    SELECT
                        id, img as imagem, posicao
                      FROM
                        imovel_galeria
                    WHERE 
                       id_imovel = ?
                    order by posicao asc
                ";

                $stmt = $this->conn->prepare($sqlQuery);
                $stmt->bindParam(1, $this->id);
                $stmt->execute();
                //$dataRow = $stmt->fetch(PDO::FETCH_ASSOC);
                
                //$this->id = $dataRow['id'];
                //$this->imagem = $dataRow['img'];
                //$this->posicao = $dataRow['posicao'];
     
                return $stmt;
            }        



    }