Ir para conteúdo
Fórum Script Brasil

jrbiasi

Membros
  • Total de itens

    4
  • Registro em

  • Última visita

Sobre jrbiasi

Contatos

  • Website URL
    http://www.openhaus.com.br/
  • Skype
    grilizim1

Perfil

  • Gender
    Male
  • Location
    Uberlândia - MG

Últimos Visitantes

O bloco dos últimos visitantes está desativado e não está sendo visualizado por outros usuários.

jrbiasi's Achievements

0

Reputação

  1. jrbiasi

    Dúvida Class

    Galera, eu agradeço de mais a ajuda de vocês, mas eu já consegui arruma o suposto erro (obs: falha minha) Vou deixar a class aqui para vocês darem uma olhada <?php class Inscricoes{ private $id; private $fk_custom_eventos; private $fk_custom_status; private $nome; private $email; private $tel_telefone; private $num_cpf_cnpj; private $created; private $updated; public function __construct($id = null) { $this->db = DB::getInstance(); if($id != null) { $this->load($id); } } public function InscricoesExists($id) { $this->db->executeSql("SELECT `id` FROM `custom_inscricoes` WHERE `id` = '{$id}'"); $result = $this->db->fetchAll(); if(count($result) > 0) { return true; } else { return false; } } public function load($id) { if(!self::InscricoesExists($id)) { return false; } $this->db->executeSql("SELECT `id`,`fk_custom_eventos`,`fk_custom_status`,`nome`,`email`,`tel_telefone`,`num_cpf_cnpj`,`created`,`updated` FROM `custom_inscricoes` WHERE `id`='{$id}'"); $row = $this->db->fetch(); $this->id = $row['id']; $this->fk_custom_eventos = $row['fk_custom_eventos']; $this->fk_custom_status = $row['fk_custom_status']; $this->nome = $row['nome']; $this->email = $row['email']; $this->tel_telefone = $row['tel_telefone']; $this->num_cpf_cnpj = $row['num_cpf_cnpj']; $this->created = $row['created']; $this->updated = $row['updated']; } public function save() { if(self::InscricoesExists($this->id)) { $this->db->executeSql("UPDATE custom_inscricoes SET fk_custom_eventos = '{$this->fk_custom_eventos}', fk_custom_status = '{$this->fk_custom_status}', nome = '{$this->nome}', email = '{$this->email}', tel_telefone = '{$this->tel_telefone}', num_cpf_cnpj = '{$this->num_cpf_cnpj}', updated = '{$this->updated}' WHERE id = '{$this->id}'"); } else { $this->db->executeSql("INSERT INTO `custom_inscricoes` (`id`,`fk_custom_eventos`,`fk_custom_status`,`nome`,`email`,`tel_telefone`,`num_cpf_cnpj`,`created`) VALUES (NULL, '{$this->fk_custom_eventos}','{$this->fk_custom_status}','{$this->nome}','{$this->email}','{$this->tel_telefone}','{$this->num_cpf_cnpj}','{$this->created}')"); $this->db->executeSql("SELECT MAX(id) as id FROM custom_inscricoes"); $row = $this->db->fetch(); $this->load($row['id']); } } public function getId(){ return $this->id; } public function getFkCustomEventos(){ return $this->fk_custom_eventos; } public function getFkCustomStatus(){ return $this->fk_custom_status; } public function getNome(){ return $this->nome; } public function getEmail(){ return $this->email; } public function getTelTelefone(){ return $this->tel_telefone; } public function getNumCpfCnpj(){ return $this->num_cpf_cnpj; } public function getCreated() { return $this->created; } public function getUpdated() { return $this->updated; } public function setId($id){ $this->id = $id; } public function setFkCustomEventos($fk_custom_eventos){ $this->fk_custom_eventos = $fk_custom_eventos; } public function setFkCustomStatus($fk_custom_status){ $this->fk_custom_status = $fk_custom_status; } public function setNome($nome){ $this->nome = $nome; } public function setEmail($email){ $this->email = $email; } public function setTelTelefone($tel_telefone){ $this->tel_telefone = $tel_telefone; } public function setNumCpfCnpj($num_cpf_cnpj){ $this->num_cpf_cnpj = $num_cpf_cnpj; } public function setCreated($created) { $this->created = $created; } public function setUpdated($updated) { $this->updated = $updated; } }
  2. jrbiasi

    Dúvida Class

    Não consigo executar me retorna o mesmo erro Using $this when not in object
  3. jrbiasi

    Dúvida Class

    O erro ocorre aqui: $this->db-executeSql $this->db->executeSql("SELECT `id` FROM `custom_inscricoes` WHERE `id` = '{$id}'");
  4. jrbiasi

    Dúvida Class

    Boa tarde tudo beleza ? espero que sim Estou com um problema de na minha class que me retorna assim: Using $this when not in object context public function __construct($id = null) { $this->db = DB::getInstance(); if($id != null) { $this->load($id); } } public static function InscricoesExists($id) { // BEM AQUI TA DANDO O ERRO NO $this->db-executeSql $this->db->executeSql("SELECT `id` FROM `custom_inscricoes` WHERE `id` = '{$id}'"); if($this->db->getNumRows() > 0) { return true; } else { return false; } }
×
×
  • Criar Novo...