• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP DBUtils类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中DBUtils的典型用法代码示例。如果您正苦于以下问题:PHP DBUtils类的具体用法?PHP DBUtils怎么用?PHP DBUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了DBUtils类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: add

 public static function add($param)
 {
     $pdo = new DBUtils();
     $key_str = "";
     $val_str = "";
     $sql = "";
     if (isset($param['type'])) {
         $key_str .= "type,";
         $val_str .= "'{$param['type']}',";
     }
     if (isset($param['studentName'])) {
         $key_str .= "studentName,";
         $val_str .= "'{$param['studentName']}',";
     }
     if (isset($param['num'])) {
         $key_str .= "num" . ",";
         $val_str .= "'{$param['num']}',";
     }
     $now = time();
     $key_str .= "time" . ",";
     $val_str .= "'{$now}',";
     $key_str .= "course" . ",";
     $val_str .= "'{$GLOBALS['STUDENT_COURSE_TYPE'][0]}',";
     $key_str = substr($key_str, 0, strlen($key_str) - 1);
     $val_str = substr($val_str, 0, strlen($val_str) - 1);
     $sql = "insert into student_news (" . $key_str . ")";
     $sql .= " VALUES (" . $val_str . ")";
     $articleId = $pdo->insert($sql);
     return $articleId;
 }
开发者ID:zcmyworld,项目名称:nothing,代码行数:30,代码来源:mod_thanks.php


示例2: getIndex

 public static function getIndex()
 {
     $pdo = new DBUtils();
     $sql = "select * from homepage";
     $rs = $pdo->query($sql);
     return $rs;
 }
开发者ID:zcmyworld,项目名称:nothing,代码行数:7,代码来源:mod_index.php


示例3: updatePhoto

 public static function updatePhoto($param)
 {
     $pdo = new DBUtils();
     $sql = "update homepage set photoUrl = '" . $param['photoUrl'] . "' where id  = '{$param['id']}'";
     $rs = $pdo->update($sql);
     return $rs;
 }
开发者ID:zcmyworld,项目名称:nothing,代码行数:7,代码来源:mod_index.php


示例4: delNav

 public static function delNav($snavId)
 {
     $pdo = new DBUtils();
     $sql = "delete from second_nav where snavId = '{$snavId}'";
     //        print_r($sql);
     //        exit;
     $rs = $pdo->delete($sql);
     return $rs;
 }
开发者ID:zcmyworld,项目名称:nothing,代码行数:9,代码来源:mod_nav.php


示例5: getOne

 public static function getOne($courseId)
 {
     $pdo = new DBUtils();
     $sql = "select * from course where courseId = {$courseId}";
     $course = $pdo->getOne($sql);
     $sql = "select * from courseType where courseId = {$courseId}";
     $courseType = $pdo->query($sql);
     return array("course" => $course, "courseType" => $courseType);
 }
开发者ID:zcmyworld,项目名称:nothing,代码行数:9,代码来源:mod_course.php


示例6: verifyUser

 public function verifyUser()
 {
     $dbUtil = new DBUtils();
     $value = $dbUtil->verifyUser($this->username, $this->password);
     if ($value) {
         $_SESSION["id"] = $this->username;
         return "Logged in sucessfully";
     } else {
         return "Log in failed. Please try with proper user.";
     }
     return $value;
 }
开发者ID:ricsr,项目名称:hello-world,代码行数:12,代码来源:UserModel.php


示例7: log

 public function log()
 {
     $log = KLogger::instance(KLOGGER_PATH . "processors/", KLogger::DEBUG);
     $log->logInfo("userxplog > log > start userId : " . $this->userId . " xp : " . $this->xp . " type : " . $this->type . " time : " . $this->time . " gameId : " . $this->gameId . " result : " . $this->result . " opponentId : " . $this->opponentId);
     if (!empty($this->userId)) {
         $userXPLog = new GameUserXpLog();
         $userXPLog->setUserId($this->userId);
         $userXPLog->setXp($this->xp);
         $userXPLog->setTime($this->time);
         $userXPLog->setType($this->type);
         $userXPLog->setGameId($this->gameId);
         $userXPLog->setResult($this->result);
         $userXPLog->setOpponentId($this->opponentId);
         try {
             $user = GameUsers::getGameUserById($this->userId);
             if (!empty($user)) {
                 $userXPLog->setUserLevel($user->userLevelNumber);
                 $userXPLog->setUserCoin($user->coins);
                 //$userCoinLog->setUserSpentCoin($user->opponentId);
             }
         } catch (Exception $exc) {
             $log->logError("userxplog > log > User Error : " . $exc->getTraceAsString());
         }
         try {
             $userXPLog->insertIntoDatabase(DBUtils::getConnection());
             $log->logInfo("userxplog > log > Success");
         } catch (Exception $exc) {
             $log->logError("userxplog > log > Error : " . $exc->getTraceAsString());
         }
     } else {
         $log->logError("userxplog > log > user Id is empty ");
     }
 }
开发者ID:bsormagec,项目名称:tavlamania-php,代码行数:33,代码来源:userxplog.class.php


示例8: getGameCategoryItemWithLanguage

 public static function getGameCategoryItemWithLanguage()
 {
     $SQL = "SELECT categories.*,lang.language AS langCode,lang.text AS langText FROM " . TBL_GAME_ITEM_CATEGORY . " AS categories," . TBL_GAME_ITEM_CATEGORY_LANGUAGE . " AS lang WHERE categories.active=1 AND categories.categoryCode=lang.categoryCode ORDER BY id ASC";
     $query = mysql_query($SQL, DBUtils::getManualConnection());
     if (!empty($query)) {
         $list = array();
         $ids = array();
         $i = 0;
         while ($db_field = mysql_fetch_assoc($query)) {
             $cat = GameItemCategory::createFromSQLWithLanguage($db_field);
             if (!empty($cat)) {
                 $catId = $cat->getId();
                 if (!empty($catId)) {
                     if (isset($ids[$catId]) && isset($list[$ids[$catId]])) {
                         $oldItem = $list[$ids[$catId]];
                         $oldItem->languages = array_merge($oldItem->languages, $cat->languages);
                     } else {
                         array_push($list, $cat);
                         $ids[$catId] = $i;
                         $i++;
                     }
                 }
             }
         }
         unset($ids);
         return $list;
     }
     return array();
 }
开发者ID:bsormagec,项目名称:tavlamania-php,代码行数:29,代码来源:GameItemCategory.class.php


示例9: gameResult

 public static function gameResult(GameUsers $user, GameUsers $opponent, $roomGroupId, $action, $gameId = null, $double = 0, $normal = true, $type = null, $time = null)
 {
     $result = new FunctionResult();
     $result->success = false;
     if (!empty($user) && !empty($action)) {
         if (empty($action) || !empty($action) && $action != GameUtils::$GAME_RESULT_ACTION_WIN && $action != GameUtils::$GAME_RESULT_ACTION_LOST) {
             $result->result = "Unknown Action";
             return $result;
         }
         GameUtils::updateXP($user, $opponent, $roomGroupId, $action, $gameId, $double, $normal, $type, $time);
         GameUtils::updateCoin($user, $opponent, $roomGroupId, $action, $gameId, $double, $normal, $type, $time);
         GameUtils::updateCounts($user, $opponent, $roomGroupId, $action, $gameId, $double, $normal, $type, $time);
         if ($action == GameUtils::$GAME_RESULT_ACTION_WIN && ($type == GameUtils::$GAME_RESULT_ACTION_TYPE_LEFT || $type == GameUtils::$GAME_RESULT_ACTION_TYPE_TIMESUP) && !empty($opponent)) {
             if (empty($time)) {
                 $time = time();
             }
             Queue::userLostConnLost($opponent->userId, $user->userId, $roomGroupId, GameUtils::$GAME_RESULT_ACTION_LOST, $gameId, $double, $normal, $type, $time);
         }
         try {
             $user->updateToDatabase(DBUtils::getConnection());
             $result->success = true;
             $result->result = new stdClass();
             $result->result->user = $user;
         } catch (Exception $exc) {
             $result->success = true;
             $result->result = $exc->getTraceAsString();
         }
         return $result;
     } else {
         $result->result = "User not found";
         return $result;
     }
 }
开发者ID:bsormagec,项目名称:tavlamania-php,代码行数:33,代码来源:GameFunctions.php


示例10: setConstant

 public static function setConstant($key, $value = null)
 {
     if (!empty($key)) {
         GameConstantUtil::setCacheConstant($key, $value);
         $setting = GameConstants::findByExample(DBUtils::getConnection(), GameConstants::create()->setKey_($key));
         if (!empty($setting)) {
             if (sizeof($setting) > 0) {
                 $setting = $setting[0];
                 $k = $setting->getKey_();
                 if (empty($k)) {
                     $setting = null;
                 }
             } else {
                 $setting = null;
             }
         }
         if (!empty($setting)) {
             $setting->setValue_($value);
         } else {
             $setting = GameConstants::create();
             $setting->setKey_($key);
             $setting->setValue_($value);
         }
         $setting->updateInsertToDatabase(DBUtils::getConnection());
     }
     return false;
 }
开发者ID:bsormagec,项目名称:tavlamania-php,代码行数:27,代码来源:GameConstantFunctions.php


示例11: getNav

function getNav()
{
    $pdo = new DBUtils();
    $sql = "select * from nav";
    $nav = $pdo->query($sql);
    $header = array();
    foreach ($nav as $key => $val) {
        $header[$val['navId']] = array("navName" => $val['navName'], "navId" => $val['navId'], "second" => array());
    }
    $sql = "select * from second_nav";
    $second = $pdo->query($sql);
    foreach ($second as $key => $val) {
        $header[$val['navId']]['second'][$val['snavId']] = array("snavName" => $val['snavName'], "snavId" => $val['snavId'], "link" => $val['snavName']);
    }
    return $header;
}
开发者ID:zcmyworld,项目名称:nothing,代码行数:16,代码来源:index.php


示例12: autoLogin

 public static function autoLogin($rememberme = true)
 {
     if (isset($_SESSION["userId"])) {
         $userId = $_SESSION["userId"];
         $user = GameUsers::getGameUserById($userId);
         if (!empty($user)) {
             UtilFunctions::storeSessionUser($user, $rememberme);
             return $user;
         }
     }
     if (isset($_COOKIE["auth"]) && false) {
         $cookie = $_COOKIE["auth"];
         $arr = explode('&', $cookie);
         $userName = substr($arr[0], 4);
         $hash = substr($arr[1], 5);
         $user = GameUsers::getGameUserByUserName($userName);
         if (!empty($user)) {
             if ($hash == md5($user->getPassword())) {
                 $user->setLastLoginDate(time());
                 $user->setLoginCount($user->getLoginCount() + 1);
                 $user->updateToDatabase(DBUtils::getConnection());
                 Queue::checkUserFriends($user->userId);
                 UtilFunctions::storeSessionUser($user, $rememberme);
                 return $user;
             } else {
                 UtilFunctions::forgetMe();
             }
         }
     }
     return false;
 }
开发者ID:bsormagec,项目名称:tavlamania-php,代码行数:31,代码来源:Functions.php


示例13: saveInDatabase

    /**
     * save data in plenty_countries_of_delivery
     * 
     * @param PlentySoapObject_GetCountriesOfDelivery $countryOfDelivery
     */
    private function saveInDatabase($countryOfDelivery)
    {
        $query = 'REPLACE INTO `plenty_countries_of_delivery` 
						' . DBUtils::buildInsert(array('country_id' => $countryOfDelivery->CountryID, 'active' => $countryOfDelivery->CountryActive, 'country_name' => $countryOfDelivery->CountryName, 'iso_code_2' => $countryOfDelivery->CountryISO2));
        $this->getLogger()->debug(__FUNCTION__ . ' save country ' . $countryOfDelivery->CountryISO2 . ' ' . $countryOfDelivery->CountryName);
        DBQuery::getInstance()->replace($query);
    }
开发者ID:PhDasen,项目名称:php_soap_client_mu,代码行数:12,代码来源:Adapter_GetCountriesOfDelivery.class.php


示例14: find_by_account

 function find_by_account($account, $limit = null)
 {
     $db =& DBUtils::connect();
     $sql = 'SELECT f.id, f.url AS url FROM foaf f
         JOIN member m ON f.member_id = m.id
         WHERE m.account = ?';
     $result = $db->getAll($sql, array($account));
     if (DB::isError($result)) {
         trigger_error(__CLASS__ . '::' . __FUNCTION__ . '(): ' . $result->toString(), E_USER_ERROR);
         return null;
     }
     $parser =& new FOAFParser(true, CACHE_LITE_DIR, 60 * 60 * 24 * 1);
     $foafs = array();
     foreach ($result as $foaf) {
         if (@$parser->parse($foaf['url']) === false) {
             continue;
         }
         $people = $parser->getKnowsPerson();
         foreach ($people as $index => $person) {
             $people[$index]['foaf_id'] = $foaf['foaf_id'];
             $people[$index]['foaf_url'] = $foaf['url'];
             $p =& new FOAFParser(true, CACHE_LITE_DIR, 60 * 60 * 24 * 1);
             if ($p->parse($person['seeAlso'])) {
                 $person['img'] = $p->getImg();
             }
             $foafs[$person['seeAlso']] = $person;
         }
     }
     $res = array();
     foreach ($foafs as $foaf) {
         $res[] = $foaf;
     }
     return $res;
 }
开发者ID:komagata,项目名称:plnet,代码行数:34,代码来源:FriendUtils.php


示例15: find_with_content_category_by_account

 function find_with_content_category_by_account($account)
 {
     $db =& DBUtils::connect();
     $sql = 'SELECT cc.id AS category_id, cc.name AS category_name, mcf.feed_id
         FROM member_to_content_category_to_feed mcf
         JOIN member m ON mcf.member_id = m.id
         JOIN content_category cc ON mcf.content_category_id = cc.id
         WHERE m.account = ?';
     $result = $db->getAll($sql, array($account));
     if (DB::isError($result)) {
         trigger_error(__CLASS__ . '::' . __FUNCTION__ . '(): ' . $result->toString(), E_USER_ERROR);
         return false;
     }
     $mcfs = $result;
     $other = ContentCategoryUtils::get(PLNET_OTHER_CATEGORY_ID);
     $feeds = FeedUtils::get_feeds_by_account($account);
     $feeds_with_category = array();
     foreach ($feeds as $key => $feed) {
         foreach ($mcfs as $i => $mcf) {
             if ($feed['id'] == $mcf['feed_id']) {
                 $feed['category_id'] = $mcf['category_id'];
                 $feed['category_name'] = $mcf['category_name'];
             }
         }
         if (!isset($feed['category_id'])) {
             $feed['category_id'] = $other['id'];
             $feed['category_name'] = $other['name'];
         }
         $feeds_with_category[] = $feed;
     }
     return $feeds_with_category;
 }
开发者ID:komagata,项目名称:plnet,代码行数:32,代码来源:FeedUtils.php


示例16: Pager

 function Pager($sql_count, $sql, $current_page)
 {
     global $g_rb_database_type, $g_rb_pagerLimit, $DB_LINK;
     $this->page_limit = $g_rb_pagerLimit;
     $this->page = $current_page;
     $this->sql = $sql;
     if ($g_rb_database_type == "postgres") {
         $sql .= " LIMIT " . $this->page_limit;
         if ($this->page > 0) {
             $sql .= " OFFSET " . ($this->page - 1) * $this->page_limit;
         }
     } else {
         if ($g_rb_database_type == "mysql") {
             $sql .= " LIMIT ";
             if ($this->page > 0) {
                 $sql .= ($this->page - 1) * $this->page_limit . ", ";
             }
             $sql .= $this->page_limit;
         }
     }
     // Get the count
     $rc = $DB_LINK->Execute($sql_count);
     DBUtils::checkResult($rc, NULL, NULL, $sql_count);
     $this->total_results = $rc->fields[0];
     // Make the query and set the results
     $this->dbResults = $DB_LINK->Execute($sql);
     DBUtils::checkResult($this->dbResults, NULL, NULL, $sql);
     // Compute the max number of pages
     $this->max_pages = ceil($this->total_results / $this->page_limit);
 }
开发者ID:pjflameboy,项目名称:phprecipebook,代码行数:30,代码来源:Pager.class.php


示例17: lookup_consumer

 function lookup_consumer($consumer_key)
 {
     /*{{{*/
     $secret = DBUtils::retrieveCustomer($consumer_key);
     if ($secret) {
         return new OAuthConsumer($consumer_key, $secret, NULL);
     }
     return NULL;
 }
开发者ID:nsystem1,项目名称:tuneefy,代码行数:9,代码来源:API.class.php


示例18: Start

 function Start($aDBServer, $aProjName)
 {
     $dbutils = new DBUtils($aDBServer);
     $dbutils->SetProject($aProjName);
     $this->iDirectory = $dbutils->GetProjDir($aProjName);
     $this->iProjName = $aProjName;
     $proj = $dbutils->GetProject();
     $this->iShowPrivate = $dbutils->GetShowPrivate($aProjName);
     $this->iDocType = $proj['fld_doctype'];
     $ds = new DocStat($dbutils);
     list($avg, $nc, $nm) = $ds->ProjStat($aProjName);
     $t = '<table width=100% border=1 style="background-color:lightblue;"><tr><td align=center><span style="font-size:20pt;font-family:arial;font-weight:bold;">' . $aProjName . "</span></td></tr></table>\n";
     $t .= '<div align=center><h3 style="color:darkred;font-family:arial;">Documentation status: ' . round($avg * 100) . '%</h3>';
     $t .= '<span style="font-family:arial;">Total number of Classes: ' . $nc . ', Methods: ' . $nm . "</span><p>\n";
     if ($this->iShowPrivate) {
         $t .= '<i>This version <b>includes</b> private methods & classes</i><p>';
     } else {
         $t .= '<i>This version does <b>not</b> include private methods & classes</i><p>';
     }
     $t .= '<p><i>Generated at ' . strftime('%d %b %Y  at  %H:%M') . "</i><br>\n";
     $t .= "</div><hr>";
     $t .= "<p>" . $proj['fld_desc'];
     if ($this->iDocType == 0) {
         $dt = 'HTML: Multiple files.';
         $this->iWriter->Open($this->iDirectory . 'projinfo.html');
         $this->iWriter->W($t);
         $this->iWriter->Close();
         $this->iWriter->Open($this->iDirectory . 'index.html');
         $this->iWriter->W($this->iIndexFramePage);
         $this->iWriter->Close();
     } else {
         $dt = 'HTML: Single file.';
         $this->iWriter->Open($this->iDirectory . 'index.html');
         $this->iWriter->W($this->iIndexPage);
         $this->iWriter->W($this->iCSS);
         $this->iWriter->W($t);
     }
     HTMLGenerator::CloseWinButton('left');
     echo "<hr>";
     echo "<font face=arial><b>Generating reference for project : <font color=blue>{$aProjName}</font></b></font><br>";
     echo "Output directory: <b><font color=blue>" . $this->iDirectory . '</font></b><br>';
     echo "Output format: <b><font color=blue>{$dt}</font></b> <p>\n";
     echo "<hr>";
 }
开发者ID:wahgithub,项目名称:chits_wah_emr,代码行数:44,代码来源:jpgenhtmldoc.php


示例19: get_tagid_by_tagname

 function get_tagid_by_tagname($tagid)
 {
     $db =& DBUtils::connect();
     $sql = "SELECT id FROM tag WHERE name = ?";
     $result =& $db->getOne($sql, array($tagid));
     if (DB::isError($result)) {
         trigger_error('PlnetUtils::get_tagid_from_tagname(): fetch error.' . $result->toString(), E_USER_ERROR);
         return false;
     }
     return $result;
 }
开发者ID:komagata,项目名称:plnet,代码行数:11,代码来源:PlnetUtils.php


示例20: get

 function get($content_category_id)
 {
     $db =& DBUtils::connect();
     $sql = 'SELECT * FROM content_category WHERE id = ?';
     $result = $db->getRow($sql, array($content_category_id));
     if (DB::isError($result)) {
         trigger_error(__CLASS__ . '::' . __FUNCTION__ . '(): ' . $result->toString(), E_USER_ERROR);
         return false;
     }
     return $result;
 }
开发者ID:komagata,项目名称:plnet,代码行数:11,代码来源:ContentCategoryUtils.php



注:本文中的DBUtils类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP DB_CONNECT类代码示例发布时间:2022-05-23
下一篇:
PHP DBUtil类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap