本文整理汇总了PHP中Conn::getConn方法的典型用法代码示例。如果您正苦于以下问题:PHP Conn::getConn方法的具体用法?PHP Conn::getConn怎么用?PHP Conn::getConn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Conn
的用法示例。
在下文中一共展示了Conn::getConn方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Connect
private function Connect()
{
// obteve a conexão
$this->conn = parent::getConn();
//cria a query
$this->create = $this->conn->prepare($this->create);
}
示例2: Connect
/**
* PRIVATE METODOS
*/
private function Connect()
{
/** Pega a Conexão com a Class Pai Conn e atribui ao $this->Conn */
$this->Conn = parent::getConn();
/** Cria o Prepare Statement do Select */
$this->Update = $this->Conn->prepare($this->Update);
}
示例3: Connect
/**
* ****************************************
* *********** PRIVATE METHODS ************
* ****************************************
*/
private function Connect()
{
$this->Conn = parent::getConn();
$this->Read = $this->Conn->prepare($this->Select);
// Retornar resultados em arrays
$this->Read->setFetchMode(PDO::FETCH_ASSOC);
}
示例4: Connect
/**
* PRIVATE METODOS
*/
private function Connect()
{
/** Pega a Conexão com a Class Pai Conn e atribui ao $this->Conn */
$this->Conn = parent::getConn();
/** Cria o Prepare Statement do Select */
$this->Read = $this->Conn->prepare($this->Select);
/** Seta o retorno dos dados no Formato fetch_assoc */
$this->Read->setFetchMode(PDO::FETCH_ASSOC);
}
示例5: smarty_function_newsView
/**
* 单信息显示
* @param type $params
* @param Tpl $tpl
* @return type
*/
function smarty_function_newsView($params, &$tpl)
{
$values = array();
$types = array();
/* @var $acStr ZeActiveString */
$acStr = new ZeActiveString();
$acStr->putAll(array('select' => 'SELECT
`id`,`title`,`category`
,`detail`,`create_time`,`edit_time`
FROM `news_e` news
WHERE 1=1
', 'where.id' => 'AND `id` = :id ', 'where.next' => 'AND `id` > :id ', 'where.category' => 'AND `category` = :category ', 'where.category.set' => 'AND FIND_IN_SET(`category`,:category) > 0 ', 'where.search' => 'AND (`title` LIKE "%" || :search || "%"
OR `detail` LIKE "%" || :search || "%") ', 'limit' => 'LIMIT 1 '));
$acStr->active('select');
$acStr->active('limit');
$id = $tpl->getArg($params, 'id', null);
if (is_numeric($id) && $id > 0) {
$values['id'] = intval($id);
$types['id'] = PDO::PARAM_INT;
$acStr->active('where.id');
}
$next = $tpl->getArg($params, 'next', null);
if (is_numeric($next) && $next > 0) {
$values['id'] = intval($next);
$types['id'] = PDO::PARAM_INT;
$acStr->active('where.next');
}
/* todo prev */
/* @var $recorder ZeRecorder */
$recorder = new ZeRecorder(Conn::getConn());
/* @var $pageSet ZePageSet */
$pageSet = $tpl->getPageSet($params);
$as = $tpl->getArg($params, 'as', 'news');
$sql = $acStr->toString();
$row = $recorder->query($sql)->bind($values, $types)->fetch();
$tpl->assign($as, $row);
}
示例6: view
/**
*
* @global UserInfo $userInfo
* @param array $fields
* @return array
*/
public static function view($fields)
{
$info = null;
do {
$values = array();
$types = array();
$sql = 'SELECT
`id`,`title`,`category`
,`detail`,`create_time`,`edit_time`
FROM `news_e`
WHERE `id` = :id
';
$values['id'] = $fields['id'];
$types['id'] = PDO::PARAM_INT;
$recorder = new ZeRecorder(Conn::getConn());
$info = $recorder->query($sql)->bind($values)->fetch();
} while (false);
return $info;
}
示例7: Connect
private function Connect()
{
$this->Conn = parent::getConn();
$this->Read = $this->Conn->prepare($this->Select);
$this->Read->setFetchMode(PDO::FETCH_ASSOC);
}
示例8: Connect
private function Connect()
{
$this->Conn = parent::getConn();
$this->Update = $this->Conn->prepare($this->Update);
}
示例9: connect
private function connect()
{
$this->conn = parent::getConn();
$this->create = $this->conn->prepare($this->create);
}
示例10: Conn
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<?php
require './_app/Config.inc.php';
$PDO = new Conn();
$name = 'Chrome';
$views = '250';
try {
$qRCreate = "INSERT INTO ws_siteviews_agent (agent_name, agent_views) VALUES (?, ?)";
$create = $PDO->getConn()->prepare($qRCreate);
$create->bindParam(1, $name, PDO::PARAM_STR, 15);
$create->bindParam(2, $views, PDO::PARAM_INT, 5);
$create->execute();
if ($create->rowCount()) {
echo "{$PDO->getConn()->lastInsertId()} - Cadastrado com sucesso <hr>";
}
$qRSelect = "SELECT * FROM ws_siteviews_agent WHERE agent_views >= :visitas";
$select = $PDO->getConn()->prepare($qRSelect);
$select->bindValue(':visitas', '7');
$select->execute();
if ($select->rowCount() >= 1) {
echo "Pesquisa retornou {$select->rowCount()} resultado(s) <hr>";
$resultado = $select->fetchAll(PDO::FETCH_ASSOC);
var_dump($resultado);
} else {
echo "Nenhum resultado encontrado <hr>";
示例11: __construct
/**
* __construct
* Inicializa a conexao e o nome da tabela
*
* @param string $table nome da tabela
*/
public function __construct($table)
{
$this->conn = parent::getConn();
$this->table = $table;
}
示例12: Conn
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<?php
require './_app/Config.inc.php';
$conn = new Conn();
$conn->getConn();
var_dump($conn->getConn());
?>
</body>
</html>
示例13: Conn
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<?php
require './_app/Config.inc.php';
$Conn = new Conn();
try {
$Query = "Select * from ws_siteviews_agent where agent_name = :name";
$Exec = $Conn->getConn()->prepare($Query);
$Exec->bindValue(":name", 'Chrome');
$Exec->execute();
$Chrome = $Exec->fetchAll(PDO::FETCH_ASSOC);
// ou apenas fetch se retornar apenas um resultado
$Exec->bindValue(":name", 'Safari');
$Exec->execute();
$Safari = $Exec->fetch(PDO::FETCH_ASSOC);
} catch (PDOException $e) {
PHPErro($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine());
}
if ($Chrome) {
// var_dump($Chrome);
echo "{$Chrome[0]['agent_name']} tem {$Chrome[0]['agent_views']} visita(s)<hr>";
}
if ($Safari) {
// var_dump($Safari);
echo "{$Safari['agent_name']} tem {$Safari['agent_views']} visita(s)<hr>";
}
示例14: Connect
/**
* ****************************************
* *********** PRIVATE METHODS ************
* ****************************************
*/
private function Connect()
{
$this->Conn = parent::getConn();
$this->Update = $this->Conn->prepare($this->Update);
$this->Update->setFetchMode(PDO::FETCH_ASSOC);
}
示例15: Conn
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<?php
require './_app/Config.inc.php';
$conn = new Conn();
try {
$query = "SELECT * FROM ws_siteviews_agent WHERE agent_name = :name";
$exe = $conn->getConn()->prepare($query);
$exe->bindValue(":name", 'Chrome');
$exe->execute();
$chrome = $exe->fetch(PDO::FETCH_ASSOC);
$exe->bindValue(":name", 'Firefox');
$exe->execute();
$firefox = $exe->fetch(PDO::FETCH_ASSOC);
} catch (PDOException $e) {
PHPErro($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine());
}
if ($chrome) {
//var_dump($chrome);
echo "{$chrome['agent_name']} tem {$chrome['agent_views']} visita(s) <hr>";
}
if ($firefox) {
//var_dump($firefox);
echo "{$firefox['agent_name']} tem {$firefox['agent_views']} visita(s) <hr>";
}
?>