本文整理匯總了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();
}