本文整理汇总了PHP中Conn类的典型用法代码示例。如果您正苦于以下问题:PHP Conn类的具体用法?PHP Conn怎么用?PHP Conn使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Conn类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: giveAuthor
public static function giveAuthor($id)
{
$db = new Conn();
if ($id == '0') {
return 'Anonymous';
} else {
$author = mysql_fetch_array($db->db_query("SELECT username FROM members WHERE id='{$id}'"));
return $author['username'];
}
}
示例2: findAll
/**
* <b>Não é passado com os Joins</b>
*
* @return array[Objetos]
*/
public function findAll()
{
$sql = "SELECT * FROM {$this->Table}";
$this->Stmt = Conn::prepare($sql);
$this->Stmt->execute();
return $this->Stmt->fetchAll();
}
示例3: Connect
private function Connect()
{
// obteve a conexão
$this->conn = parent::getConn();
//cria a query
$this->create = $this->conn->prepare($this->create);
}
示例4: 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);
}
示例5: updateAccount
/**
* @param $Account ClientAccount
*/
public static function updateAccount($Account)
{
include_once $_SERVER['DOCUMENT_ROOT'] . "/bossflex/DB/Conn.php";
$sql = "UPDATE ClientAccount SET Balance = ? WHERE AccountNum = ?";
$stmt = Conn::get()->prepare($sql);
$stmt->execute(array($Account->getBalance(), $Account->getAccountNum()));
}
示例6: addDependent
/**
* @param $employee Employee
* @param $dependent Dependent
*/
public static function addDependent($employee, $dependent)
{
include_once $_SERVER['DOCUMENT_ROOT'] . "/bossflex/DB/Conn.php";
$sql = "INSERT INTO Dependents (EID, CID, Fname, Lname, Relation, Birthday) VALUES (?, ?, ?, ?, ?, ?)";
$stmt = Conn::get()->prepare($sql);
$stmt->execute(array($employee->getEID(), $employee->getCID(), $dependent->getFname(), $dependent->getLname(), $dependent->getRelation(), $dependent->Birthday));
}
示例7: 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);
}
示例8: 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);
}
示例9: getRoleList
public static function getRoleList()
{
include_once "../../bossflex/DB/Conn.php";
$sql = "SELECT RoleID, Role\n FROM UserRole\n ORDER BY RoleID DESC \n LIMIT 0 , 30";
$stmt = Conn::get()->query($sql, PDO::FETCH_ASSOC);
$roleList = array();
while ($role = $stmt->fetchObject(__CLASS__)) {
$roleList[] = $role;
}
return $roleList;
}
示例10: getCodeList
public static function getCodeList()
{
include_once "../../bossflex/DB/Conn.php";
$sql = "SELECT Code, Reason\n FROM DisableCode";
$stmt = Conn::get()->query($sql, PDO::FETCH_ASSOC);
$codeList = array();
while ($code = $stmt->fetchObject(__CLASS__)) {
$codeList[] = $code;
}
return $codeList;
}
示例11: getReport
public static function getReport()
{
include_once $_SERVER['DOCUMENT_ROOT'] . "/bossflex/DB/Conn.php";
$conn = Conn::get();
$sql = "SELECT * FROM Exception ORDER BY TimeStamp DESC";
try {
return $conn->query($sql);
} catch (Exception $e) {
return null;
}
}
示例12: BackupDatabase
public function BackupDatabase($database)
{
$connection = parent::getConnection();
// try{
// $backup = $connection->prepare('mysqldump -u root -p 123456 '. $database .' > ' . HOME . 'archives/backup.sql');
// $backup->execute();
// return true;
// }catch(Exception $e){
// return false;
// $this->result = $e;
// }
return system('mysqldump -u root -p 123456 ' . $database . ' > ' . HOME . 'archives/backup.sql');
}
示例13: PDO
/**
* 数据库连接
*/
public static function &getConn()
{
if (self::$conn == null) {
$conn = new PDO(sprintf(Config::DB_LINK, DIR_ROOT), "charset=UTF-8");
if (IS_DEBUG) {
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} else {
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
}
self::$conn = $conn;
}
return self::$conn;
}
示例14: depositAmt
public static function depositAmt($AccountNum, $DepositedByUID, $Amount, $PayRollDate)
{
include_once $_SERVER['DOCUMENT_ROOT'] . "/bossflex/DB/Conn.php";
$db = Conn::get();
$sql = "INSERT INTO Deposit (AccountNum, DepositedByUID, Amount, PayRollDate) VALUES (?, ?, ?, ?)";
$stmt = $db->prepare($sql);
$stmt->execute(array($AccountNum, $DepositedByUID, $Amount, $PayRollDate));
$depID = $db->lastInsertId();
$sql = "SELECT * FROM Deposit WHERE DepositID = :id";
$stmt = Conn::get()->prepare($sql);
$stmt->bindParam(":id", $depID, PDO::PARAM_INT);
$stmt->execute();
return $stmt->fetchObject(__CLASS__);
}
示例15: getInstance
public static function getInstance()
{
if (is_null(self::$instance)) {
self::$instance = new self();
}
return self::$instance;
}