本文整理汇总了PHP中DbConn类的典型用法代码示例。如果您正苦于以下问题:PHP DbConn类的具体用法?PHP DbConn怎么用?PHP DbConn使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DbConn类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
require_once _base_ . '/lib/lib.json.php';
$this->db = DbConn::getInstance();
$this->model = new ProfileLms();
$this->json = new Services_JSON();
$this->aclManager = Docebo::user()->getAClManager();
$this->max_dim_avatar = 150;
}
示例2: init
public function init()
{
parent::init();
require_once _base_ . '/lib/lib.json.php';
$this->db = DbConn::getInstance();
$this->model = new GroupmanagementAdm();
$this->json = new Services_JSON();
$this->permissions = array('view' => checkPerm('view', true, 'groupmanagement'), 'add' => checkPerm('add', true, 'groupmanagement'), 'mod' => checkPerm('mod', true, 'groupmanagement'), 'del' => checkPerm('del', true, 'groupmanagement'), 'associate_user' => checkPerm('associate_user', true, 'groupmanagement'));
}
示例3: id
function id($verify = FALSE)
{
$id = get_cookie('admin_id');
if (!$id) {
return FALSE;
}
// If no verification is necessary, we're good to go
if (!$verify) {
return $id;
}
$token = get_cookie('admin_token');
if (!$token) {
return FALSE;
}
$db = new DbConn();
$result = $db->query('select * from admins where id = ?', $id);
$admin = $result->next();
if (!$admin) {
return FALSE;
}
if ($admin->token != $token) {
return FALSE;
}
return $id;
}
示例4: checkLogin
public static function checkLogin($userName, $password)
{
$sql = "select * from manager where userName='{$userName}' and password='{$password}'";
$conn = new DbConn();
$result = $conn->executeQuery($sql);
$conn->close();
return $result[0];
}
示例5: addReviews
public static function addReviews($articleId, $userName, $body, $face)
{
$sql = "insert into reviews(articleId,userName,body,face)values({$articleId},'{$userName}','{$body}','{$face}')";
$conn = new DbConn();
$row = $conn->executeUpdate($sql);
$conn->close();
return $row;
}
示例6: getNewsTypes
public static function getNewsTypes()
{
$sql = "select * from newsTypes";
$conn = new DbConn();
$result = $conn->executeQuery($sql);
$conn->freeResult();
$conn->close();
return $result;
}
示例7: delete_note
function delete_note($noteid)
{
$db = new DbConn();
$result = $db->fetch('select userid from notes where id = ?');
if ($result) {
$db->exec('delete from notes where id = ?', $noteid);
log_event(LOG_NOTE_DELETED, $result->userid, $noteid);
}
}
示例8: DbConn
public function DbConn()
{
$connStr = 'mysql:host=localhost;dbname=esplm';
$dbConn = new PDO($connStr, 'root', '');
$dbConn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
self::$dbConn = $dbConn;
}
示例9: getBbsInfo
public function getBbsInfo()
{
$sql = "select * from bbsinfo";
$conn = DbConn::getInstance();
$bbsInfo = $conn->query($sql);
return $bbsInfo;
}
示例10: findAll
public function findAll($conditions, $params)
{
$db = DbConn::getInstance();
$query = $db->query("SELECT c.idCourse, c.course_type, c.idCategory, c.code, c.name, c.description, c.difficult, c.status AS course_status, c.course_edition, " . "\tc.max_num_subscribe, c.create_date, " . "\tc.direct_play, c.img_othermaterial, c.course_demo, c.use_logo_in_courselist, c.img_course, c.lang_code, " . "\tc.course_vote, " . "\tc.date_begin, c.date_end, c.valid_time, c.show_result, c.userStatusOp, c.auto_unsubscribe, c.unsubscribe_date_limit, " . "\tcu.status AS user_status, cu.level, cu.date_inscr, cu.date_first_access, cu.date_complete, cu.waiting" . " FROM %lms_course AS c " . " JOIN %lms_courseuser AS cu ON (c.idCourse = cu.idCourse) " . " WHERE " . $this->compileWhere($conditions, $params) . ($_SESSION['id_common_label'] > 0 ? " AND c.idCourse IN (SELECT id_course FROM %lms_label_course WHERE id_common_label = '" . $_SESSION['id_common_label'] . "')" : "") . " ORDER BY " . $this->_resolveOrder(array('cu', 'c')));
$result = array();
$courses = array();
while ($data = $db->fetch_assoc($query)) {
$data['enrolled'] = 0;
$data['numof_waiting'] = 0;
$data['first_lo_type'] = FALSE;
$courses[] = $data['idCourse'];
$result[$data['idCourse']] = $data;
}
if (!empty($courses)) {
// find subscriptions
$re_enrolled = $db->query("SELECT c.idCourse, COUNT(*) as numof_associated, SUM(waiting) as numof_waiting" . " FROM %lms_course AS c " . " JOIN %lms_courseuser AS cu ON (c.idCourse = cu.idCourse) " . " WHERE c.idCourse IN (" . implode(',', $courses) . ") " . " GROUP BY c.idCourse");
while ($data = $db->fetch_assoc($re_enrolled)) {
$result[$data['idCourse']]['enrolled'] = $data['numof_associated'] - $data['numof_waiting'];
$result[$data['idCourse']]['numof_waiting'] = $data['numof_waiting'];
}
// find first LO type
$re_firstlo = $db->query("SELECT o.idOrg, o.idCourse, o.objectType FROM %lms_organization AS o " . " WHERE o.objectType != '' AND o.idCourse IN (" . implode(',', $courses) . ") " . " GROUP BY o.idCourse ORDER BY o.path");
while ($data = $db->fetch_assoc($re_firstlo)) {
$result[$data['idCourse']]['first_lo_type'] = $data['objectType'];
}
}
return $result;
}
示例11: index
function index()
{
$this->load->helper('mail');
$db = new DbConn();
$mails = $db->query('select * from mails_scheduled where due <= NOW()');
while ($mail = $mails->next()) {
$user_id = $mail->userid;
$mail_id = $mail->mailid;
$template = get_mail_template($mail_id, false);
if (!$template) {
continue;
}
send_user_mail($template, $user_id);
$db->exec('delete from mails_scheduled where id = ?', $mail->id);
}
}
示例12: deleteAllCourseAdvices
/**
* @param int $id_course the id of the course to be deleted
*
* @return bool true if success false otherwise
*/
function deleteAllCourseAdvices($id_course)
{
//validate input
if ((int) $id_course <= 0) {
return false;
}
$db = DbConn::getInstance();
$db->start_transaction();
//get all existing advices for the course
$arr_id_advice = array();
$query = "SELECT idAdvice FROM %lms_advice WHERE idCourse = " . (int) $id_course;
$res = $db->query($query);
while (list($id_advice) = $db->fetch_row($res)) {
$arr_id_advice[] = $id_advice;
}
//delete all adviceusers
if (!empty($arr_id_advice)) {
$query = "DELETE FROM %lms_adviceuser WHERE idAdvice IN (" . implode(",", $arr_id_advice) . ")";
$res = $db->query($query);
if (!res) {
$db->rollback();
return false;
}
}
//delete course advices
$query = "DELETE FROM %lms_advice WHERE idCourse = '" . (int) $id_course . "'";
$res = $db->query($query);
if (!$res) {
$db->rollback();
return false;
}
$db->commit();
return true;
}
示例13: getNewsTypes
public static function getNewsTypes()
{
$sql = "select * from newsTypes";
$conn = DbConn::getInstance();
$newsTypes = $conn->query($sql);
return $newsTypes;
}
示例14: checkLogin
public static function checkLogin($userName, $password)
{
$sql = "select * from manager where userName='{$userName}' and password='{$password}'";
$conn = DbConn::getInstance();
$userInfo = $conn->queryOne($sql);
return $userInfo;
}
示例15: getNewsTypes
public static function getNewsTypes()
{
$sql = "select * from newsTypes";
$conn = DbConn::getInstance();
$result = $conn->queryAll($sql);
return $result;
}