本文整理汇总了PHP中db_connect类的典型用法代码示例。如果您正苦于以下问题:PHP db_connect类的具体用法?PHP db_connect怎么用?PHP db_connect使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了db_connect类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct()
{
require_once dirname(__FILE__) . '/db_connect.php';
// opening db connection
$db = new db_connect();
$this->conn = $db->connect();
}
开发者ID:xunxu,项目名称:meacaga,代码行数:7,代码来源:db_handler.php
示例2: __construct
public function __construct()
{
include_once 'db_connect.php';
include_once 'functions.php';
try {
$connect_db = new db_connect();
$this->link = $connect_db->connect();
$this->functions = new db_functions();
} catch (Exception $ex) {
return mysqli_error($this->link);
}
}
开发者ID:vontman,项目名称:new_mvc_github,代码行数:12,代码来源:tasks.php
示例3: getInstance
public static function getInstance()
{
if (!self::$_instance) {
self::$_instance = new db_connect();
}
return self::$_instance;
}
开发者ID:CSUN-Comp490,项目名称:TeamUp,代码行数:7,代码来源:db_connect.php
示例4: wisdomRecord
static function wisdomRecord($id = 0, $education = 0)
{
db_connect::connect();
if ($id != 0 && $education == 0) {
$information = R::load('information', $id);
$information->shortdescription = $_POST['shortdescription'];
$information->category_id = $_GET['category'];
$information->sharedUser[] = $_SESSION['user'];
} elseif ($id == 0 && $education == 0) {
$information = R::dispense('information');
$information->shortdescription = $_POST['shortdescription'];
$information->category_id = $_GET['category'];
$information->sharedUser[] = $_SESSION['user'];
} elseif ($id != 0 && $education != 0) {
// echo 1;
$information = R::load('education', $education);
$information->number = $_POST['number'];
$information->information_id = $id;
}
$information->name = $_POST['name'];
$information->description = $_POST['description'];
$id = R::store($information);
// print_r($id);
return $id;
}
开发者ID:Jluct,项目名称:obuceisea,代码行数:25,代码来源:teacher.php
示例5: connect
/**
* connexion a la BDD
*/
private static function connect () {
self::$db_connect = new mysqli(self::$DB_SRV, self::$DB_USER, self::$DB_MDP, self::$DB_NAME);
if (self::$db_connect->connect_error) {
die('Erreur de connexion (' . self::$db_connect->connect_errno . ') ' . self::$db_connect->connect_error);
}
self::$instance = TRUE;
}
开发者ID:roger-jb,项目名称:edeip,代码行数:11,代码来源:db_connect.php
示例6: __construct
public function __construct()
{
$this->_db = db_connect::getInstance();
$this->_mysqli = $this->_db->getConnection();
echo $this->PageHeader();
echo $this->LoadPageBody();
echo $this->LoadPageFooter();
$this->_functions = new functions();
}
开发者ID:CSUN-Comp490,项目名称:TeamUp,代码行数:9,代码来源:loader.php
示例7: __construct
function __construct($query, $array)
{
// $this->items = getDataBase::getData("SELECT *
// FROM `menu` , `menu_item`
// WHERE menu_item.menu_id =" . intval($id) . "
// AND menu.menu_id = menu_item.menu_id");
db_connect::connect();
$this->items = R::getAll($query, $array);
}
开发者ID:Jluct,项目名称:obuceisea,代码行数:9,代码来源:menu.php
示例8: getWisdomByType
function getWisdomByType($array, $wisdomArray, $page = 1)
{
if (!(int) $array[0]) {
return false;
}
$out = '';
db_connect::connect();
if (empty($wisdomArray)) {
$out .= "<h2>Ничего не найдено</h2>";
return $out;
}
foreach ($wisdomArray as $key => $value) {
$out .= "<h2>" . $key . "</h2><table class='table table-striped'>\r\n <tr>\r\n <th>Название</th>\r\n <th>Автор</th>\r\n <th>Категория</th>\r\n <th>Субкатегория</th>\r\n </tr>";
foreach ($value as $smallKey => $subValue) {
$category = R::load('category', $subValue['subcategory_id']);
if ($array[3] && $array[2]) {
$step = 10;
$page3 = ($page - 1) * $step;
$data = $category->withCondition('information.category_id = ? LIMIT ?,?', [$array[3], $page3, $step])->ownInformationList;
self::$count_data += $category->withCondition('information.category_id = ? LIMIT ?,?', [$array[3], $page3, $step])->countOwn('information');
self::$path = "?ctrl=wisdom&action=WisdomType&type=" . $array[0] . "&subtype=" . $array[1] . "&category=" . $array[2] . "&subcategory=" . $array[3];
} else {
$step = 10;
$step1 = 2;
// echo $page;
$page2 = ($page - 1) * $step;
$page1 = ($page - 1) * $step1;
$data = $array[1] ? $category->with(' LIMIT ?,?', [$page2, $step])->ownInformationList : $category->with(' LIMIT ?,?', [$page1, $step1])->ownInformationList;
self::$count_data += $array[1] ? $category->with(' LIMIT ?,?', [$page2, $step])->countOwn('information') : $category->with(' LIMIT ?,?', [$page1, $step1])->countOwn('information');
// echo " ".self::$count_data." ";
self::$path = $array[1] ? "?ctrl=wisdom&action=WisdomType&type=" . $array[0] . "&subtype=" . $array[1] : "?ctrl=wisdom&action=WisdomType&type=" . $array[0];
}
foreach ($data as $item) {
if (!$item && $array[2]) {
$out .= "<tr><td colspan='4'><h4 class='text-center'><b>Ничего не найдено</b></h4></td></tr>";
continue;
}
$autor = self::getAuthorName($item->id);
$out .= "<tr>\r\n <td><a href='?ctrl=wisdom&action=GetWisdomById&id=" . $item->id . "'>" . $item->name . "</a></td>\r\n <td><a href='?ctrl=cabinet&action=UserInfo&id=" . $autor['id'] . "'>" . $autor['login'] . "</a> |\r\n <a href='?ctrl=cabinet&action=UserInfo&id=" . $autor['id'] . "'> " . $autor['surname'] . " " . $autor['name'] . " " . $autor['andername'] . " </a></td>\r\n <td>" . $smallKey . "</td>\r\n <td>" . $subValue['category_name'] . "</td>\r\n\r\n </tr>";
}
}
$out .= "</table>";
}
if ($array[3] && $array[2] && $_SESSION['user']->status == 'teacher' && $_SESSION['user']->block == 0) {
$out .= "<a role='button' href='?ctrl=teacher&action=WisdomData&type=" . $array[0] . "&subtype=" . $array[1] . "&category=" . $array[2] . "&subcategory=" . $array[3] . "&page=1' class='btn btn-info btn-block'>Добавить учебный материал</a>";
}
return $out;
}
开发者ID:Jluct,项目名称:obuceisea,代码行数:48,代码来源:wisdom.php
示例9: categorMenu
static function categorMenu($array, $page = 1)
{
$open = '';
db_connect::connect();
$data = R::load('type', $array[0]);
$item = '';
if (!$array[1]) {
$item = $data->ownType;
} else {
$item = $data->withCondition('id = :id', ["id" => $array[1]])->ownType;
}
$out = "";
foreach ($item as $i) {
$i_count = 0;
if (!$array[2]) {
$j = $i->ownCategoryList;
} else {
$j = $i->withCondition('category.id = ? LIMIT 0,3', [$array[2]])->ownCategoryList;
}
foreach ($j as $v) {
$v_count = 0;
foreach ($v->ownCategory as $o) {
if (!$v_count && $o->name) {
$v_count = 1;
if ($v->id == $array[2]) {
$open = "open";
}
if (!$i_count) {
$i_count = 1;
$out .= "<h4>" . $i->name . "</h4>";
}
$out .= "<div class=\"dropdown {$open}\">\r\n <button class=\"btn btn-default btn-block dropdown-toggle\" type=\"button\" id=\"dropdownMenu1\" data-toggle=\"tooltip\"\r\n aria-haspopup=\"true\" aria-expanded=\"true\">\r\n <a href='?ctrl=wisdom&action=WisdomType&type=" . $data->id . "&subtype=" . $i->id . "&category=" . $v->id . "&page=1'>" . $v->name . "<span class=\"caret\"></span></a></button>\r\n <ul class=\"dropdown-menu\" aria-labelledby=\"dropdownMenu1\">";
}
if ($o->name) {
self::$information_count += $o->countOwn('information');
self::$wisdomArray[$i->name][$o->name]['type_id'] = $data->id;
self::$wisdomArray[$i->name][$o->name]['subtype_name'] = $i->name;
self::$wisdomArray[$i->name][$o->name]['category_name'] = $v->name;
self::$wisdomArray[$i->name][$o->name]['subcategory_id'] = $o->id;
$out .= "<li><a href='?ctrl=wisdom&action=WisdomType&type=" . $data->id . "&subtype=" . $i->id . "&category=" . $v->id . "&subcategory=" . $o->id . "&page=1'>" . $o->name . "</a></li>";
}
}
$out .= "</ul></div>";
}
}
return $out;
}
开发者ID:Jluct,项目名称:obuceisea,代码行数:47,代码来源:categoryList.php
示例10: delete
public function delete(){
$query = "DELETE FROM TRIMESTRE WHERE idTrimestre = ".$this->getIdTrimestre();
if (db_connect::query($query))
return true;
return false;
}
开发者ID:roger-jb,项目名称:edeip,代码行数:6,代码来源:Trimestre.php
示例11: delete
public function delete(){
$query = "DELETE FROM MATIERE_NIVEAU WHERE idMatiereNiveau = ".$this->getIdMatiereNiveau();
if (db_connect::query($query))
return true;
return false;
}
开发者ID:roger-jb,项目名称:edeip,代码行数:6,代码来源:MatiereNiveau.php
示例12: spl_autoload_register
<?php
/**
* Created by PhpStorm.
* User: инкогнито
* Date: 03.01.2016
* Time: 16:08
*/
require_once __DIR__ . '/autoload.php';
require_once __DIR__ . '/application/core/connect/db_connect.php';
//try {
if (!isset($_GET['ctrl'])) {
$ctrl = "defaultController";
$action = "actionDefault";
} else {
$controller = $ctrl = $_GET['ctrl'];
$ctrl .= 'Controller';
$action = 'action';
$action .= $_GET['action'];
}
spl_autoload_register('myAutoload');
db_connect::connect();
$view = new View();
$controller = new $ctrl();
$controller->{$action}($view);
// $view = new View();
// $view->abc = 123;
//} catch(Exception $e) {
// die('Ошибка');
//}
开发者ID:Jluct,项目名称:obuceisea,代码行数:30,代码来源:load.php
示例13: throw_the_bum_out
//copyright 2010,2014-2015 C.D.Price
$_TEMP_PERMIT = "_LEGAL_";
//a temp permission for the "are you logged in" gate (in prepend)
require_once "prepend.php";
require_once "common.php";
require_once "db_" . $_SESSION['_SITE_CONF']['DBMANAGER'] . ".php";
if (isset($_POST["btnSubmit"])) {
//logging out
throw_the_bum_out("Goodbye!", "Logout: by id=" . $_SESSION["person_id"]);
//let prepend take care of it (not really a bum)
}
$organization = "";
$person = "";
if (isset($_SESSION["person_id"])) {
//logged in
$db = new db_connect($_SESSION['_SITE_CONF']['DBEDITOR']);
$sql = "SELECT name FROM " . $db->prefix . "a00_organization WHERE organization_id=:org";
$stmt = $db->prepare($sql);
$stmt->bindValue(':org', $_SESSION["organization_id"], PDO::PARAM_INT);
$stmt->execute();
if (!($row = $stmt->fetchObject())) {
$organization = "--No Organization--";
} else {
$organization = COM_output_edit($row->name);
}
$stmt->closeCursor();
$sql = "SELECT firstname, lastname FROM " . $db->prefix . "c00_person WHERE person_id=:person";
$stmt = $db->prepare($sql);
$stmt->bindValue(':person', $_SESSION["person_id"], PDO::PARAM_INT);
$stmt->execute();
$row = $stmt->fetchObject();
开发者ID:bbogin,项目名称:sr2s,代码行数:31,代码来源:head.php
示例14: __construct
function __construct()
{
require_once 'db_connect.php';
$db = db_connect::getInstance();
$this->conn = $db->getConnection();
}
开发者ID:TheMaximumDrive,项目名称:witestify-server,代码行数:6,代码来源:db_functions.php
示例15: userInfo
static function userInfo($id)
{
db_connect::connect();
$user = R::load('user', $id);
$status = $user->status == 'teacher' ? 'Преподаватель' : 'Студент';
$out = "<div class='col-sm-4 text-center'>\r\n <img style=\"max-width: 100%;max-height:100%;margin: 15px; \" src='images/user/" . $user->dossier->image . "'>\r\n </div>\r\n <div class='col-sm-8'>\r\n <h3>" . $user->login . " | " . $user->dossier->surname . " " . $user->dossier->name . " " . $user->dossier->andername . "</h3>";
$out .= "<ul class=\"list-group\">\r\n <li class=\"list-group-item\"><h4>Основная информация</h4></li>\r\n <li class=\"list-group-item\">Статус: " . $status . "</li>\r\n <li class=\"list-group-item\">Страна: " . $user->dossier->land . "</li>\r\n <li class=\"list-group-item\">Город: " . $user->dossier->sity . "</li>\r\n <li class=\"list-group-item\">Электронная почта: " . $user->dossier->email . "</li>\r\n <li class=\"list-group-item\">Количество учебных материалов: " . $user->withCondition('activ = 1 and education_id is null and lesson_id is null')->countShared('information') . " </li>\r\n </ul>\r\n </div>";
$about = $user->dossier->about ? $user->dossier->about : '<h3>Нет инфориации</h3>';
$out .= "<div class='col-sm-12'>\r\n <div class=\"panel panel-primary\">\r\n <div class=\"panel-heading\">О себе</div>\r\n <div class=\"panel-body\">" . $about . "</div>\r\n </div>\r\n </div>";
if ($user->status === 'teacher') {
$data = $user->withCondition('activ=1')->sharedInformationList;
// print_r($data);
$out .= "<div class='col-sm-12'><div class=\"list-group\"><ul style='padding-left:0; '>";
$out .= "<li class=\"list-group-item active\">\r\n <h4 class=\"list-group-item-heading \">Разработанные учебные материалы</h4>\r\n </li>";
foreach ($data as $item) {
$short_description = !empty($item->shortdescription) ? $item->shortdescription : 'Краткое описание отсутствует';
$out .= "<li class=\"list-group-item\">\r\n <h4 class=\"list-group-item-heading\"><a href='?ctrl=wisdom&action=GetWisdomById&id=" . $item->id . "'>" . $item->name . "</a></h4>\r\n <p class=\"list-group-item-text\">" . $short_description . "</p>\r\n </li>";
}
$out .= "</ul></div></div>";
}
return $out;
}
开发者ID:Jluct,项目名称:obuceisea,代码行数:22,代码来源:cabinet.php
示例16: update
public function update(){
$query = " UPDATE BULLETIN
SET
dateRedaction = '".$this->getDateRedacton()."',
contenuBulletin = '".db_connect::escape_string($this->getContenuBulletin())."',
idEleve = ".$this->getIdEleve().",
idMatiereNiveau = ".$this->getIdMatiereNiveau()."
WHERE idBulletin = ".$this->getIdBulletin();
if (db_connect::query($query)){
return true;
}
return false;
}
开发者ID:roger-jb,项目名称:edeip,代码行数:13,代码来源:Bulletin.php
示例17: delete
public function delete(){
$query = "DELETE FROM EVALUATION_POINT_CPT WHERE idEvaluationPointCpt = ".$this->getIdEvaluationPointCpt();
if (db_connect::query($query))
return true;
return false;
}
开发者ID:roger-jb,项目名称:edeip,代码行数:6,代码来源:EvaluationPointCpt.php
示例18:
<option value=""></option>
</select>
</td>
</tr>
<tr>
<td colspan="2">
<input type="button" class="submit" id="btAdd" name="ajouter" value="Ajouter">
<input type="button" class="submit" id="btDel" name="retirer" value="Retirer">
</td>
</tr>
</table>
</fieldset>
<fieldset>
<legend>Liste des matieres de l'élève</legend>
<div id="listeMatiere">
</div>
</fieldset>
<br>
</div>
<div style="clear: both"></div>
</div>
<?php
include '../Include/include_footer.php';
db_connect::close();
?>
</div>
<script src="affectMatiere.js"></script>
</body>
</html>
开发者ID:roger-jb,项目名称:edeip,代码行数:31,代码来源:affectMatiere.php
示例19: actionUpdateUserData
function actionUpdateUserData($view)
{
$userArray = array();
$errorArray = array();
$session = $_SESSION['user'];
if (!empty($_POST['firstPassword']) && !empty($_POST['anderPassword']) && $_POST['firstPassword'] === $_POST['anderPassword']) {
$session->password = $_POST['firstPassword'];
} elseif (empty($_POST['firstPassword']) && $_POST['firstPassword'] != '' && empty($_POST['anderPassword']) && $_POST['firstPassword'] === $_POST['anderPassword']) {
$view->message = ["Пароли не совпадают или не все поля заполненны", "Внимание", 4];
$errorArray = $_POST;
$view->data = cabinet::getUserData($userArray, $errorArray);
echo $view->render('cabinet.php');
return;
}
foreach ($_POST as $key => $value) {
if ($key == 'firstPassword' || $key == 'anderPassword') {
if (empty($value)) {
continue;
}
}
if ($key == 'email') {
if (preg_match("~([a-zA-Z0-9!#\$%&\\'*+-/=?^_`{|}\\~])@([a-zA-Z0-9-]).([a-zA-Z0-9]{2,4})~", $value)) {
$userArray[$key] = htmlspecialchars($value);
continue;
} else {
$errorArray[$key] = htmlspecialchars($value);
continue;
}
}
if ($key == 'about') {
if (count($value) < 2000) {
$userArray[$key] = htmlspecialchars($value);
continue;
} else {
$errorArray[$key] = htmlspecialchars($value);
continue;
}
}
if ($key == 'phone') {
if (preg_match("/^[+0-9-]{5,30}\$/", $value)) {
$userArray[$key] = htmlspecialchars($value);
continue;
} else {
$errorArray[$key] = htmlspecialchars($value);
continue;
}
}
if (!preg_match('/^[A-Za-zАаБбВвГгДдЕеЁёЖжЗзИиЙйКкЛлМмНнОоПпРрСсТтУуФфХхЦцЧчШшЩщЪъЫыЬьЭэЮюЯя0-9_]{2,30}$/', trim($value))) {
$errorArray[$key] = htmlspecialchars($value);
} else {
$userArray[$key] = htmlspecialchars($value);
}
//
}
if (!isset($errorArray)) {
$view->message = ["Неверные данные или заполненны не все обязательные поля", "Внимание", 4];
} elseif (isset($userArray) && empty($errorArray)) {
foreach ($session->dossier as $key => $value) {
if ($_SESSION['user']->dossier->{$key} && isset($userArray[$key])) {
$session->dossier->{$key} = $userArray[$key];
}
}
db_connect::connect();
$id = R::store($session);
if (!$id) {
$view->message = ["Ошибка записи. Проверьте данные", "Ошибка", 4];
}
$view->message = ["Ваши личные данные изменены:", "Данные изменены", 1];
$userArray = $errorArray = '';
} else {
$view->message = ["Ошибка записи. Проверьте данные", "Ошибка", 4];
}
$view->data = cabinet::getUserData($userArray, $errorArray);
echo $view->render('cabinet.php');
}
开发者ID:Jluct,项目名称:obuceisea,代码行数:75,代码来源:cabinetController.php
示例20: getPageById
static function getPageById($id)
{
db_connect::connect();
$page = R::load('page', $id);
return $page;
}
开发者ID:Jluct,项目名称:obuceisea,代码行数:6,代码来源:pageData.php
注:本文中的db_connect类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论