本文整理汇总了PHP中Conn::connect方法的典型用法代码示例。如果您正苦于以下问题:PHP Conn::connect方法的具体用法?PHP Conn::connect怎么用?PHP Conn::connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Conn
的用法示例。
在下文中一共展示了Conn::connect方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cadastrar_paciente
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;
}
示例2: excluir_secretaria
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;
}
示例3: Conectar
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;
}
示例4: Connection
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;
}
示例5: __construct
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();
}
示例6: __construct
public function __construct()
{
$this->pdo = Conn::connect();
}