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;
}
}