![]() Server : LiteSpeed System : Linux premium84.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64 User : claqxcrl ( 523) PHP Version : 8.1.32 Disable Function : NONE Directory : /home/claqxcrl/www/classes/ |
<?php require_once "Crud.php"; class Posts extends Crud{ protected $tabela = 'tblposts'; protected $tblcateg = 'tblcategoria'; protected $tblsubcateg = 'tblsubcategoria'; protected $tblcomments = 'tblcomments'; protected $tblclassificacao = 'tblclassificacao'; protected $tblclubes = 'tblclubes'; protected $tblresultados = 'tblresultados'; protected $tblclaquetv = 'tblclaquetv'; protected $tblproxjogos = 'tblproxjogos'; protected $tblcompeticao = 'tblcompeticao'; protected $tblpaises = 'tblpaises'; protected $tblestadios = 'tblestadios'; protected $tbljogadores = 'tbljogadores'; protected $tblposicoes = 'tblposicoes'; protected $tblclaquefotos = 'tblclaquefotos'; protected $tblclaqueaudio = 'tblclaqueaudio'; public $jogadorImg = 'ondjoweb/admin/galeriafotos/jogadorImg/'; public $postImg = 'ondjoweb/admin/galeriafotos/postImg/'; public $imgCaminho = 'ondjoweb/admin/galeriafotos/'; public $logosCaminho = 'ondjoweb/admin/galeriafotos/logos'; public $imgJogadorCaminho = 'ondjoweb/admin/postimages/jogadores/'; /*Atributos da classe Posts */ private $postTitulo; private $categoriaId; private $postTexto; public function setPostTitulo($pt){ $this->postTitulo=$pt; } public function setCategoriaId($ci){ $this->categoriaId=$ci; } public function setPostTexto($ptext){ $this->postTexto=$ptext; } /**Metodos para inserir post */ public function inserirRegisto(){ $sql= "INSERT INTO $this->tabela (postTitulo, catgoriaId, postTexto) VALUES (:postTitulo, :categoriaId, :postTexto)"; $stmt= DB::prepare($sql); $stmt->bindParam(':postTitulo', $this->postTitulo); $stmt->bindParam(':categoriaId', $this->categoriaId); $stmt->bindParam(':postTexto', $this->postTexto); return $stmt->execute(); } /**Metodos para actualizar post */ public function atualizarRegisto($id){ $sql= "UPDATE $this->tabela SET postTitulo = :postTitulo, catgoriaId = :categoriaId, postTexto = :postTexto) WHERE id = :id"; $stmt= DB::prepare($sql); $stmt->bindParam(':postTitulo', $this->postTitulo); $stmt->bindParam(':categoriaId', $this->categoriaId); $stmt->bindParam(':postTexto', $this->postTexto); $stmt->bindParam(':id', $id); return $stmt->execute(); } }