當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DbConn類代碼示例

本文整理匯總了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;
 }
開發者ID:abhinay100,項目名稱:forma_app,代碼行數:9,代碼來源:ProfileLmsController.php

示例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'));
 }
開發者ID:abhinay100,項目名稱:forma_app,代碼行數:9,代碼來源:GroupmanagementAdmController.php

示例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;
 }
開發者ID:jcheng5,項目名稱:vteer,代碼行數:25,代碼來源:Admin.php

示例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];
 }
開發者ID:xiaowanzi1204,項目名稱:news,代碼行數:8,代碼來源:Manager.php

示例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;
 }
開發者ID:xiaowanzi1204,項目名稱:news,代碼行數:8,代碼來源:Reviews.php

示例6: getNewsTypes

 public static function getNewsTypes()
 {
     $sql = "select * from newsTypes";
     $conn = new DbConn();
     $result = $conn->executeQuery($sql);
     $conn->freeResult();
     $conn->close();
     return $result;
 }
開發者ID:xiaowanzi1204,項目名稱:news,代碼行數:9,代碼來源:NewsTypes.php

示例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);
    }
}
開發者ID:jcheng5,項目名稱:vteer,代碼行數:9,代碼來源:note_helper.php

示例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;
 }
開發者ID:sanusi87,項目名稱:project_one,代碼行數:7,代碼來源:dbconn.php

示例9: getBbsInfo

 public function getBbsInfo()
 {
     $sql = "select * from bbsinfo";
     $conn = DbConn::getInstance();
     $bbsInfo = $conn->query($sql);
     return $bbsInfo;
 }
開發者ID:denson7,項目名稱:phpstudy,代碼行數:7,代碼來源:BbsInfoModel.php

示例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;
 }
開發者ID:abhinay100,項目名稱:forma_app,代碼行數:28,代碼來源:CourseLms.php

示例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);
     }
 }
開發者ID:jcheng5,項目名稱:vteer,代碼行數:16,代碼來源:cron.php

示例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;
 }
開發者ID:abhinay100,項目名稱:forma_app,代碼行數:39,代碼來源:lib.advice.php

示例13: getNewsTypes

 public static function getNewsTypes()
 {
     $sql = "select * from newsTypes";
     $conn = DbConn::getInstance();
     $newsTypes = $conn->query($sql);
     return $newsTypes;
 }
開發者ID:denson7,項目名稱:phpstudy,代碼行數:7,代碼來源:NewsTypes.php

示例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;
 }
開發者ID:denson7,項目名稱:phpstudy,代碼行數:7,代碼來源:Manager.php

示例15: getNewsTypes

 public static function getNewsTypes()
 {
     $sql = "select * from newsTypes";
     $conn = DbConn::getInstance();
     $result = $conn->queryAll($sql);
     return $result;
 }
開發者ID:Minionstim,項目名稱:DayNews,代碼行數:7,代碼來源:NewsTypes.php


注:本文中的DbConn類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。