public function cadastrar_paciente()
 {
     $conn = parent::connect();
     $result = $conn->query("INSERT INTO paciente (nome,cpf,data_nasc,telefone,endereco,nome_user,senha) VALUES ('" . $this->getNome_completo() . "','" . $this->getCpf() . "','" . $this->getData_nasc() . "','" . $this->getTelefone() . "','" . $this->getEndereco() . "','" . $this->getNome_user() . "','" . $this->getSenha() . "')");
     if ($result) {
         $m = 1;
     } else {
         $m = 0;
     }
     return $m;
 }
 public function excluir_secretaria()
 {
     $conn = parent::connect();
     $id = $this->getId();
     $result = $conn->query("DELETE FROM secretaria WHERE cod_secretaria = {$id}");
     if ($result) {
         $result = 1;
     } else {
         $result = 0;
     }
     return $result;
 }
Example #3
0
 private static function Conectar()
 {
     try {
         if (self::$connect == null) {
             $dsn = 'mysql:host=' . self::$host . ';dbname=' . self::$dbsa;
             $options = [PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES UTF8'];
             self::$connect = new PDO($dsn, self::$user, self::$pass, $options);
         }
     } catch (PDOException $e) {
         die("Erro {$e->getMessage()}");
     }
     self::$connect->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     return self::$connect;
 }
Example #4
0
 private static function Connection()
 {
     if (self::$connect == null) {
         try {
             $dsn = 'mysql:host=' . self::$host . ';dbname=' . self::$database;
             $options = [PDO::MYSQL_ATTR_INIT_COMMAND => 'set names utf8'];
             self::$connect = new PDO($dsn, self::$user, self::$pass, $options);
         } catch (PDOException $ex) {
             die('Erro: ' . $ex->getMessage());
         }
     }
     self::$connect->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     return self::$connect;
 }
Example #5
0
 public function __construct()
 {
     require_once BASEPATH . DIRECTORY_SEPARATOR . APPPATH . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'database.php';
     if (!defined('HOSTNAME') || !defined('USERNAME') || !defined('PASSWORD') || !defined('DBNAME') || !defined('MYSQLPORT')) {
         foreach ($_db['userlogin'] as $key => $value) {
             $key = strtoupper($key);
             define($key, $value);
         }
         //die('Arquivo de configuração não está configurado corretamente. Configure o caminho do servidor mysql, com porta login e senha.');
     }
     $this->pdo = Conn::connect();
     $this->code = null;
     $this->elementQuery['tabela'] = '';
     $this->elementQuery['campos'] = '';
     $this->elementQuery['valores'] = '';
     $this->elementQuery['condicao'] = '';
     $this->elementQuery['orderBy'] = '';
     $this->elementQuery['limit'] = '';
     $this->elementQuery['parameters'] = array();
 }
Example #6
0
 public function __construct()
 {
     $this->pdo = Conn::connect();
 }