本文整理汇总了PHP中DBFactory::getMysqlConnexionWithPDO方法的典型用法代码示例。如果您正苦于以下问题:PHP DBFactory::getMysqlConnexionWithPDO方法的具体用法?PHP DBFactory::getMysqlConnexionWithPDO怎么用?PHP DBFactory::getMysqlConnexionWithPDO使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBFactory
的用法示例。
在下文中一共展示了DBFactory::getMysqlConnexionWithPDO方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($id)
{
$myDB = new DBFactory();
$this->sql = $myDB->getMysqlConnexionWithPDO();
$this->classes = $this->getClasses();
$this->id = $id;
}
示例2: getRole
function getRole($role)
{
$myDB = new DBFactory();
$sql = $myDB->getMysqlConnexionWithPDO();
$query = $sql->prepare("SELECT id, login, role FROM users WHERE role = :role AND login != :me");
$query->execute(array('role' => $role, 'me' => $_SESSION['user']));
return $query->fetchAll();
}
示例3: getCharacters
function getCharacters()
{
$myDB = new DBFactory();
$sql = $myDB->getMysqlConnexionWithPDO();
$query = $sql->prepare("SELECT chars.*, class.name AS className, spec1.role_name AS role1, spec2.role_name AS role2 FROM chars, specs AS spec1, specs AS spec2, class WHERE chars.spec1 = spec1.id AND chars.spec2 = spec2.id AND spec1.class_id = class.id");
$query->execute();
return $query->fetchAll();
}
示例4: explode
<?php
session_start();
define('DB_NAME', 'dream');
define('DB_USER', 'da');
define('DB_PASSWORD', 'dream-admin2015');
include_once '../include/functions.php';
include_once '../include/DBF.php';
$user = "Anonymous";
if (notNull($_SESSION) && notNull($_SESSION['user'])) {
$user = $_SESSION['user'];
}
$url = explode("/", currentPage());
$page = $url[sizeof($url) - 1];
$myDB = new DBFactory();
$sql = $myDB->getMysqlConnexionWithPDO();
$sql->beginTransaction();
try {
$statement = "INSERT INTO deadlinks (link) VALUES(:link)";
$query = $sql->prepare($statement);
$query->execute(array('link' => currentPage()));
$sql->commit();
} catch (Exception $e) {
$sql->rollBack();
}
logWarning($user, 2, $user . " requested a dead link : " . currentPage());
?>
<h1>404</h1>
<p>La page que vous avez demandé n'existe pas ou plus</p>
<a href="/">Retourner à l'accueil</a>
示例5: __construct
public function __construct()
{
$myDB = new DBFactory();
$this->sql = $myDB->getMysqlConnexionWithPDO();
}
示例6: getFeeds
function getFeeds($search = "")
{
$queryStr = "SELECT * FROM feeds";
$args = array();
$searches = array();
if ($search != "") {
if (strpos($search, "::")) {
$queryStr .= " WHERE";
if (strpos($search, ";")) {
$searches = explode(";", $search);
} else {
$searches[0] = $search;
}
$i = 0;
foreach ($searches as $option) {
$option = explode("::", $option);
if ($i == 0) {
$queryStr .= " feeds." . $option[0] . " = :s_" . $option[0];
} else {
$queryStr .= " AND feeds." . $option[0] . " = :s_" . $option[0];
}
$i++;
$args["s_" . $option[0]] = $option[1];
}
} else {
echo "FATAL";
logError($_SESSION['user'], 3, $_SESSION['user'] . " tried to find unreachable feed with search criteria : " . $search);
}
}
$myDB = new DBFactory();
$sql = $myDB->getMysqlConnexionWithPDO();
$queryStr .= " ORDER BY feeds.post_date DESC;";
$query = $sql->prepare($queryStr);
$query->execute($args);
$result = $query->fetchAll();
return $result;
}
示例7: NewsManagerPDO
<?php
require 'lib/autoload.php';
$db = DBFactory::getMysqlConnexionWithPDO();
$manager = new NewsManagerPDO($db);
?>
<!DOCTYPE html>
<html>
<head>
<title>Accueil du site</title>
<meta charset="utf-8" />
</head>
<body>
<p><a href="admin.php">Accéder à l'espace d'administration</a></p>
<?php
if (isset($_GET['id'])) {
$news = $manager->getUnique((int) $_GET['id']);
echo '<p>Par <em>', $news->auteur(), '</em>, le ', $news->dateAjout()->format('d/m/Y à H\\hi'), '</p>', "\n", '<h2>', $news->titre(), '</h2>', "\n", '<p>', nl2br($news->contenu()), '</p>', "\n";
if ($news->dateAjout() != $news->dateModif()) {
echo '<p style="text-align: right;"><small><em>Modifiée le ', $news->dateModif()->format('d/m/Y à H\\hi'), '</em></small></p>';
}
} else {
echo '<h2 style="text-align:center">Liste des 5 dernières news</h2>';
foreach ($manager->getList(0, 5) as $news) {
if (strlen($news->contenu()) <= 200) {
$contenu = $news->contenu();
} else {
$debut = substr($news->contenu(), 0, 200);
$debut = substr($debut, 0, strrpos($debut, ' ')) . '...';
$contenu = $debut;
示例8: createPage
} else {
if (is_file('manager/' . $class_name . '.php')) {
require_once 'manager/' . $class_name . '.php';
}
}
}
spl_autoload_register("my_autoload");
require_once 'lib/Facebook/autoload.php';
//Session call
session_start();
//Make inludes and add html headers, modules...
function createPage($pageName)
{
//Include Header & navbar
include "views/modules/module.header.php";
include "views/modules/module.navbar.php";
include 'views/view.' . $pageName . '.php';
//include footer
include "views/modules/module.footer.php";
}
function isLogged()
{
if (isset($_SESSION['user']) && !empty($_SESSION['user']) && $_SESSION['user'] instanceof User) {
return true;
} else {
return false;
}
}
$dbFactory = new DBFactory();
$db = $dbFactory->getMysqlConnexionWithPDO();
$mailer = new UnisalesMailer();
示例9: initDB
function initDB()
{
$myDB = new DBFactory();
$sql = $myDB->getMysqlConnexionWithPDO();
return $sql;
}