本文整理汇总了PHP中_db函数的典型用法代码示例。如果您正苦于以下问题:PHP _db函数的具体用法?PHP _db怎么用?PHP _db使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_db函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getNavMenuObj
function getNavMenuObj($menuid, $menuAutoGroupFile = null, $params = null)
{
if ($params == null) {
$params = array("dbtable" => _dbtable("links"), "requiredTableList" => _db(true)->getTableList(), "requiredModuleList" => null, "sysdb" => false, "site" => SITENAME);
}
if ($menuAutoGroupFile != null) {
if (file_exists($menuAutoGroupFile)) {
$json = file_get_contents($menuAutoGroupFile);
$arrMenu = json_decode($json, true);
if ($arrMenu == null) {
$arrMenu = array();
} else {
foreach ($arrMenu as $a => $b) {
if (isset($b['enabled']) && !$b['enabled'] && !$allGenerators) {
unset($arrMenu[$a]);
}
}
}
}
} else {
$arrMenu = array();
}
$sm = new AutoMenus($arrMenu);
//$sm->printTitle($params['printTitle']);
$sm->requiredTableList($params['requiredTableList']);
$sm->requiredModuleList($params['requiredModuleList']);
$sm->generateSQL($params['site'], $_SESSION["SESS_PRIVILEGE_NAME"], $params['sysdb']);
return $sm;
}
示例2: order_matching_user_hase
function order_matching_user_hase()
{
global $fromDate, $toDate, $tmpFromDate, $tmpToDate, $maxTradingDate, $func;
//HOSE
$db = _db('eps');
$db->query('call sp_getStockSymbolList("' . $maxTradingDate . '",2)');
$objs = $db->fetchAll();
$db->connect();
//Kiem tra symbol truyen vao ton tai hay khong
$hasSymbol = false;
$symbol = '';
if (!empty($_GET['symbol'])) {
$symbol = $_GET['symbol'];
}
foreach ($objs as $item) {
$data['StockSymbols'][] = $item['StockSymbol'];
if ($symbol == $item['StockSymbol']) {
$hasSymbol = true;
$data['StockSymbol'] = $symbol;
$data['SecurityName'] = $item['SecurityName'];
}
}
if (!empty($data['StockSymbols'])) {
$data['StockSymbols'] = json_encode($data['StockSymbols']);
}
//Neu co symbol thi filter theo symbol
if ($hasSymbol) {
$data['hase_current_security'] = get_hn_security_filter($symbol, $fromDate, $toDate);
$func = 'hase.filter';
$data['symbol'] = $symbol;
} else {
$db->connect();
$data['maxtradingdate'] = $maxTradingDate;
$db->query('call sp_HN_getCurrentMarketInfo("' . $maxTradingDate . '")');
if ($obj = $db->fetch()) {
$data['hase_total_market'] = $obj;
}
$db->connect();
$db->query('call sp_getTopUp("' . $maxTradingDate . '",2)');
if ($objs = $db->fetchAll()) {
$data['hase_top_gainers'] = $objs;
}
$db->connect();
$db->query('call sp_getTopDown("' . $maxTradingDate . '", 2)');
if ($objs = $db->fetchAll()) {
$data['hase_top_losers'] = $objs;
}
$db->connect();
$db->query('call sp_getTopActive("' . $maxTradingDate . '",2)');
if ($objs = $db->fetchAll()) {
$data['hase_top_last_vol'] = $objs;
}
$data['hase_current_security'] = get_hn_security($maxTradingDate);
}
$data['from_date'] = $fromDate;
$data['to_date'] = $toDate;
$data['chart_startdate'] = date("Y-m-d", mktime(0, 0, 0, date("m", strtotime($maxTradingDate)) - 6, date("d", strtotime($maxTradingDate)), date("Y", strtotime($maxTradingDate))));
$data['chart_today'] = $maxTradingDate;
return $data;
}
示例3: saveFeedback
function saveFeedback()
{
$feedback = array('name' => '', 'email' => '', 'subject' => '', 'message' => '', 'userid' => $_SESSION['SESS_USER_ID'], 'blocked' => 'false', 'dtoc' => date('Y-m-d H:i:s'), 'dtoe' => date('Y-m-d H:i:s'));
foreach ($feedback as $k => $v) {
if (isset($_POST[$k])) {
$feedback[$k] = trim($_POST[$k]);
}
}
$sql = _db()->_insertQ1('feedbacks', $feedback);
$res = _dbQuery($sql);
$id = _db()->insert_id();
if ($res) {
_dbFree($res);
//send email to admin
$mailto = "dawkharrupali@gmail.com";
$mailfrom = "admin@openlogiks.com";
$feedback_content = array("name" => $_REQUEST['name'], "email" => $_REQUEST['email'], "subject" => $_REQUEST['subject'], "message" => $_REQUEST['message']);
$template = _template("feedback_admin", $profile);
loadHelpers('email');
sendMail($mailto, " Feedback", $template, $mailfrom);
return "success";
} else {
return "error";
}
}
示例4: feedindustry_feed_main
function feedindustry_feed_main()
{
$db = _db('stockbiz');
$db->query('SELECT SectorId FROM _prefix_sector');
$objs = $db->fetchAll();
for ($i = 0; $i < count($objs); $i++) {
feedIndustryBySector($objs[$i]['SectorId']);
}
}
示例5: db_ping
function db_ping($name = "default")
{
$i = _db($name);
if (mysql_ping($i) == False) {
mysql_close($i);
unset($GLOBALS["_db_instance_{$name}"]);
}
return _db($name);
}
示例6: feedlastestfinalratios_feed_symbol
function feedlastestfinalratios_feed_symbol()
{
$db = _db('stockbiz');
$db->query('SELECT Symbol FROM symbol');
$objs = $db->fetchAll();
for ($i = 0; $i < count($objs); $i++) {
feedLastestFinalRatiosBySymbol($objs[$i]['Symbol']);
}
}
示例7: registerSettings
function registerSettings($name, $value = "", $scope = "default")
{
$data = array("userid" => $_SESSION['SESS_USER_ID'], "site" => SITENAME, "scope" => $scope, "name" => $name, "settings" => $value);
$q = _db(true)->_insertQ1(_dbtable("settings", true), $data);
$res = _dbQuery($q, true);
if ($res) {
return true;
} else {
return false;
}
}
示例8: get_hn_security
function get_hn_security($date)
{
$db = _db('eps');
$db->connect();
$db->query('call sp_HN_getCurrentStockInfo("' . $date . '")');
$ret = $db->fetchAll();
for ($i = 0; $i < count($ret); $i++) {
$result[$i]["StockSymbol"] = $ret[$i]["StockCode"];
$result[$i]["PriorClosePrice"] = $ret[$i]["BasicPrice"] / 1000;
$result[$i]["ceiling"] = $ret[$i]["CeilingPrice"] / 1000;
$result[$i]["floor"] = $ret[$i]["FloorPrice"] / 1000;
$result[$i]["best3bid"] = $ret[$i]["BOrdPrice3"] / 1000;
$result[$i]["best3bidvolume"] = $ret[$i]["BOrdQtty3"];
$result[$i]["best2bid"] = $ret[$i]["BOrdPrice2"] / 1000;
$result[$i]["best2bidvolume"] = $ret[$i]["BOrdQtty2"];
$result[$i]["best1bid"] = $ret[$i]["BOrdPrice1"] / 1000;
$result[$i]["best1bidvolume"] = $ret[$i]["BOrdQtty1"];
$result[$i]["best3offer"] = $ret[$i]["SOrdPrice3"] / 1000;
$result[$i]["best3offervolume"] = $ret[$i]["SOrdQtty3"];
$result[$i]["best3offer"] = $ret[$i]["SOrdPrice3"] / 1000;
$result[$i]["best3offervolume"] = $ret[$i]["SOrdQtty3"];
$result[$i]["best3offer"] = $ret[$i]["SOrdPrice3"] / 1000;
$result[$i]["best3offervolume"] = $ret[$i]["SOrdQtty3"];
$result[$i]["best2offer"] = $ret[$i]["SOrdPrice2"] / 1000;
$result[$i]["best2offervolume"] = $ret[$i]["SOrdQtty2"];
$result[$i]["best1offer"] = $ret[$i]["SOrdPrice1"] / 1000;
$result[$i]["best1offervolume"] = $ret[$i]["SOrdQtty1"];
$result[$i]["last_price"] = $ret[$i]["MatchPrice"] / 1000;
$result[$i]["last_volume"] = $ret[$i]["TotalTradingQtty"];
$result[$i]["LastVal"] = $ret[$i]["TotalTradingValue"];
$result[$i]["unmatch_bid"] = $result[$i]["best3bidvolume"] + $result[$i]["best2bidvolume"] + $result[$i]["best1bidvolume"];
$result[$i]["unmatch_offer"] = $result[$i]["best3offervolume"] + $result[$i]["best2offervolume"] + $result[$i]["best1offervolume"];
if ($result[$i]["last_price"] == 0) {
$result[$i]["last_change"] = $result[$i]["change"] = 0;
} else {
$result[$i]["last_change"] = $result[$i]["change"] = ($ret[$i]["MatchPrice"] - $ret[$i]["BasicPrice"]) / 1000;
}
$result[$i]["fbuy"] = $ret[$i]["FBuy"];
$result[$i]["fsell"] = $ret[$i]["FSell"];
$result[$i]["currentroom"] = $ret[$i]["RemainForeignQtty"];
$result[$i]["securityname"] = $ret[$i]["SecurityName"];
$result[$i]["totaltradingquantity"] = $ret[$i]["NmTotalTradedQtty"];
$result[$i]["highestprice"] = $ret[$i]["HighestPrice"] / 1000;
$result[$i]["lowestprice"] = $ret[$i]["LowestPrice"] / 1000;
if ($ret[$i]["ClosePrice"] != 0) {
$result[$i]["percentage_change"] = $ret[$i]["BasicPrice"] / $ret[$i]["ClosePrice"];
} else {
$result[$i]["percentage_change"] = 0;
}
}
$db->connect();
return $result;
}
示例9: news_admin_main
function news_admin_main()
{
$paging = new Paging('p', _result_per_page(), 1, 9);
$paging->sCurrentPageClass = 'current';
$paging->sPageNextClass = 'next';
$sqlOrder = 'news_id desc';
if (!empty($_GET['sortby'])) {
$sortby = $_GET['sortby'];
$sort = $_GET['sort'];
if ($sort == 'asc') {
$sqlOrder = $sortby . ' asc';
} else {
if ($sort == 'desc') {
$sqlOrder = $sortby . ' desc';
}
}
}
$sqlOrder = 'ordering DESC,is_category desc,' . $sqlOrder;
$data = array();
$db = _db();
$pid = 0;
$parent = null;
if (!empty($_GET['pid'])) {
$pid = $_GET['pid'];
if ($pid != 0) {
$db->prepare('SELECT news_id, parent_id FROM `_prefix_news` WHERE news_id=:ID');
$db->bindValue(':ID', $pid, PARAM_INT);
$db->execute();
if ($parent = $db->fetch()) {
$data['parent'] = $parent;
} else {
$pid = 0;
}
}
}
$cats[0] = '-- Không thuộc nhóm --';
getCategoryList($cats);
$data['category'] = $cats;
$db->prepare('SELECT SQL_CALC_FOUND_ROWS ordering ,is_quantam, is_tieudiem,news_id, news_created, news_title, is_category, is_enabled, is_showintroimage,introimage FROM `_prefix_news` WHERE parent_id=:PARENT_ID ORDER BY :ORDER LIMIT :OFFSET, :TOTAL');
$db->bindValue(':PARENT_ID', $pid, PARAM_INT);
$db->bindValue(':ORDER', $sqlOrder, PARAM_NONE);
$db->bindValue(':OFFSET', $paging->getResultRowStart(), PARAM_INT);
$db->bindValue(':TOTAL', _result_per_page(), PARAM_INT);
$db->execute();
die('xyz');
if ($items = $db->fetchAll()) {
$data['items'] = $items;
}
//Lay tong cong so record
$paging->nTotalRow = $db->total_last_limit_query();
$data['paging'] = $paging;
return $data;
}
示例10: push_user_upcom
function push_user_upcom()
{
$db = _db('eps');
$db->query('call sp_upcom_getCurrentMarketInfo("' . maxTradingDate() . '")');
if ($data = $db->fetch()) {
$obj['MarketIndex'] = _num_format($data['MarketIndex']);
$obj['CHGIndex'] = _num_format($data['CHGIndex']);
$obj['PCTIndex'] = _num_format($data['PCTIndex']);
echo json_encode($obj);
}
exit(0);
}
示例11: companyrank_user_main
function companyrank_user_main()
{
$db = _db('stockbiz');
$data = array();
$view = 0;
if (!empty($_GET['view'])) {
$view = intval($_GET['view']);
}
if (!empty($_GET['sectorid'])) {
$sectorId = intval($_GET['sectorid']);
//{Lay thong tin nganh
$db->query('SELECT * FROM _prefix_sector WHERE SectorId=' . $sectorId);
if ($result = $db->fetch()) {
//{Lay cac linh vuc thuoc nganh
$db->query('SELECT * FROM _prefix_industry WHERE SectorId=' . $sectorId);
$result['Industries'] = $db->fetchAll();
//}
$data['sector'] = $result;
}
//}
//{Lay cac cong ty thuoc linh vuc
$db->query('SELECT c.Symbol,CompanyName,LFY,Quarter,Year,MarketCapitalization/1000000000 AS MarketCapitalization,DilutedPE_LFY,DilutedPE_TTM FROM _prefix_companyinfo c, _prefix_lastestfinancialratios f
WHERE c.Symbol=f.Symbol AND c.IndustryID IN (SELECT IndustryID FROM _prefix_industry WHERE SectorId=' . $sectorId . ')');
if ($result = $db->fetchAll()) {
$data['company'] = $result;
}
//}
$data['display'] = 'sector';
} elseif (!empty($_GET['industryid'])) {
$industryId = intval($_GET['industryid']);
//{Lay thong tin nganh
$db->query('SELECT * FROM _prefix_industry WHERE IndustryId=' . $industryId);
if ($result = $db->fetch()) {
//{Lay cac linh vuc thuoc nganh
$db->query('SELECT * FROM _prefix_sector WHERE SectorId=' . $result['SectorId']);
$data['sector'] = $db->fetch();
//}
$data['industry'] = $result;
}
//}
//{Lay cac cong ty thuoc nganh
$db->query('SELECT c.Symbol,CompanyName,LFY,Quarter,Year,MarketCapitalization/1000000000 AS MarketCapitalization,DilutedPE_LFY,DilutedPE_TTM FROM _prefix_companyinfo c, _prefix_lastestfinancialratios f
WHERE c.Symbol=f.Symbol AND c.IndustryID=' . $industryId);
if ($result = $db->fetchAll()) {
$data['company'] = $result;
}
//}
$data['display'] = 'industry';
}
$data['view'] = $view;
return $data;
}
示例12: getGroupInfo
function getGroupInfo($groupid)
{
$sql = _db(true)->_selectQ(_dbTable("users_group", true), "*")->_where(array("id" => $groupid));
if (!isset($_SESSION['SESS_PRIVILEGE_ID']) || $_SESSION['SESS_PRIVILEGE_ID'] > ROLE_PRIME) {
$sql->_where(["guid" => $data['SESS_GUID']]);
}
$data = $sql->_GET();
if ($data) {
return $data[0];
} else {
return false;
}
}
示例13: currentSession
function currentSession($date)
{
global $_session;
if ($_session == -1) {
$db = _db('eps');
$db->query('call sp_getSession_MarketStat(' . maxTradingDate($date) . ');');
$result = $db->fetch();
$_session = $result['Session'];
//reset lai de o ngoai khong phai connect
$db->connect();
}
return $_session;
}
示例14: new_warning_post
function new_warning_post($post_or_userid, $subject, $message, $points, $KIND)
{
global $userdata, $settings, $locale;
if ($KIND == "Forum") {
$new_warning_sql = dbquery("SELECT post_id, thread_id, forum_id, post_author FROM " . DB_POSTS . " WHERE post_id='" . $post_or_userid . "'");
}
if ($KIND == "Other" || dbrows($new_warning_sql) != 0) {
if ($KIND == "Forum") {
$post_warn_data = dbarray($new_warning_sql);
$warnuser_id = $post_warn_data['post_author'];
$post = $post_or_userid;
$threadid = $post_warn_data['thread_id'];
$forumid = $post_warn_data['forum_id'];
} else {
$warnuser_id = $post_or_userid;
$post = "0";
$threadid = "0";
$forumid = "0";
}
$insertdate = date("U");
$sql = dbquery("INSERT INTO " . DB_WARNING . "\r\n\t\t(warn_kind, user_id, post_id, thread_id, forum_id, warn_subject, warn_message, warn_point, warn_admin, warn_datestamp)\r\n\t\tVALUES\r\n\t\t(" . _db($KIND) . ", " . _db($warnuser_id) . ", " . _db($post) . ", " . _db($threadid) . ", " . _db($forumid) . ", " . _db($subject) . ", " . _db($message) . ",\r\n\t\t" . _db($points) . ", " . _db($userdata['user_id']) . ", " . _db($insertdate) . ");");
// We need to send a PM to the warned user
if ($settings['warning_set_send_pm'] == 1) {
$pn_subject = stripinput(trim($locale['WARN210']));
if ($KIND == "Forum") {
$in = $locale['WARN211'] . " [url=" . $settings['siteurl'] . "forum/viewthread.php?thread_id=" . $post_warn_data['thread_id'] . "&pid=" . $post_warn_data['post_id'] . "#post_" . $post_warn_data['post_id'] . "]" . GetPostTitle($post_warn_data['thread_id']) . "[/url]\n";
} else {
$in = '';
}
$warning_subject = dbarray(dbquery("SELECT warn_subject FROM " . DB_WARNING_CATALOG . " WHERE warn_id='" . $subject . "'"));
$data_w = dbarray(dbquery("SELECT warn_length FROM " . DB_WARNING_CATALOG . " WHERE warn_id='" . (int) $subject . "'"));
$warning_length = $insertdate + $data_w['warn_length'] * 86400;
$pn_messages = stripinput(trim($in . $locale['WARN212'] . " " . $warning_subject['warn_subject'] . "\r\n\t\t\t\t\t\t\t\t\t" . $locale['WARN213'] . " " . $message . "\r\n\t\t\t\t\t\t\t\t\t" . $locale['WARN214'] . date($locale['WARN215'], $warning_length) . $locale['WARN216']));
if ($settings['warning_set_pm_from'] == 0) {
$pn_from = $userdata['user_id'];
} else {
$pn_from = $settings['warning_set_pm_from'];
}
$result = dbquery("INSERT INTO " . DB_MESSAGES . " (message_to, message_from, message_subject, message_message, message_smileys, message_read, message_datestamp, message_folder) VALUES ('" . $warnuser_id . "','" . $pn_from . "','" . $pn_subject . "','" . $pn_messages . "','y','0','" . $insertdate . "','0')");
}
// We need to send a PM to an Admin if User has more than 100 points
if (show_warning_points($warnuser_id) >= 100) {
$pn_subject = stripinput(trim($locale['WARN217']));
$pn_messages = stripinput(trim("The member reached the limit:\n [url=" . $settings['siteurl'] . "warning.php?lookup=" . $warnuser_id . "]" . $locale['WARN218'] . "[/url]\n You should take some actions and suspend/bann this member!"));
$result = dbquery("INSERT INTO " . DB_MESSAGES . " (message_to, message_from, message_subject, message_message, message_smileys, message_read, message_datestamp, message_folder) VALUES ('" . $settings['warning_set_pm_to'] . "','" . "0" . "','" . $pn_subject . "','" . $pn_messages . "','y','0','" . $insertdate . "','0')");
}
return true;
} else {
return false;
}
}
示例15: createDataSelector
function createDataSelector($dbLink, $groupID, $allowNone = true, $format = "select", $orderBy = null, $params = array())
{
if (isset($_SESSION['SESS_PRIVILEGE_ID'])) {
$where = "blocked='false' && groupid='{$groupID}' and (privilege='*' OR FIND_IN_SET('{$_SESSION['SESS_PRIVILEGE_NAME']}',privilege))";
} else {
$where = "blocked='false' && groupid='{$groupID}' and privilege='*'";
}
if ($orderBy == null) {
$where .= " ORDER BY title";
} elseif (strlen($orderBy) > 0) {
$where .= " ORDER BY {$orderBy}";
}
return createDataSelectorFromTable(_db(), _dbtable("lists"), "title", "value", "class", null, $where, null, false, $allowNone, $format, $params);
}