本文整理汇总了PHP中db_get_one函数的典型用法代码示例。如果您正苦于以下问题:PHP db_get_one函数的具体用法?PHP db_get_one怎么用?PHP db_get_one使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了db_get_one函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: db_ashiato_insert_c_ashiato
/**
* あしあとを付ける
*/
function db_ashiato_insert_c_ashiato($c_member_id_to, $c_member_id_from)
{
// 同一人物の場合は記録しない
if ($c_member_id_to == $c_member_id_from) {
return false;
}
// 一定時間以内の連続アクセスは記録しない
$wait = date('Y-m-d H:i:s', strtotime('-5 minute'));
$sql = 'SELECT c_ashiato_id FROM c_ashiato WHERE r_datetime > ?' . ' AND c_member_id_to = ? AND c_member_id_from = ?';
$params = array($wait, intval($c_member_id_to), intval($c_member_id_from));
if (db_get_one($sql, $params, 'main')) {
return false;
}
// 忍び足
if (USE_SHINOBIASHI) {
if (db_member_is_shinobiashi($c_member_id_from)) {
return false;
}
}
$data = array('c_member_id_from' => intval($c_member_id_from), 'c_member_id_to' => intval($c_member_id_to), 'r_datetime' => db_now(), 'r_date' => db_now());
if (!db_insert('c_ashiato', $data)) {
return false;
}
if ($ashiato_mail_num = db_ashiato_ashiato_mail_num4c_member_id($c_member_id_to)) {
//総足あと数を取得
$ashiato_num = db_ashiato_c_ashiato_num4c_member_id($c_member_id_to);
//あしあとお知らせメールを送る
if ($ashiato_num == $ashiato_mail_num) {
do_common_send_ashiato_mail($c_member_id_to, $c_member_id_from);
}
}
return true;
}
示例2: _getTable
function _getTable()
{
$sql = "SELECT value FROM c_admin_config WHERE name = 'admin_hashtable'";
if ($v = db_get_one($sql)) {
return unserialize($v);
} else {
return array();
}
}
示例3: missing_contrib_amount
function missing_contrib_amount($DB, $trans_id, $error_detected)
{
if (is_numeric($trans_id)) {
$total_amount = db_get_one($DB, "SELECT trans_amount\n\t\t\t\t\t\t\t FROM " . PREFIX_DB . "transactions\n\t\t\t\t\t\t\t WHERE trans_id={$trans_id}", $error_detected);
$current_amount = $DB->GetOne("SELECT SUM(montant_cotis)\n\t\t\t\t\t\t\tFROM " . PREFIX_DB . "cotisations\n\t\t\t\t\t\t\tWHERE trans_id={$trans_id}");
return $total_amount - $current_amount;
}
return 0;
}
示例4: insert_login_reject
function insert_login_reject()
{
$sql = 'SELECT COUNT(*) FROM c_login_failure WHERE ip_addr = ?';
$params = array($this->ip_addr);
if (db_get_one($sql, $params) >= $this->check_num) {
$data = array('ip_addr' => $this->ip_addr, 'expired_at' => date('Y-m-d H:i:s', time() + $this->reject_time));
db_insert('c_login_reject', $data);
}
}
示例5: execute
function execute($requests)
{
// メンバー数が1の場合のみ表示する
$sql = 'SELECT COUNT(*) FROM c_member';
if (db_get_one($sql) > 1) {
exit;
}
return 'success';
}
示例6: db_api_get_member_token
/**
* @copyright 2005-2008 OpenPNE Project
* @license http://www.php.net/license/3_01.txt PHP License 3.01
*/
function db_api_get_member_token($c_member_id)
{
$sql = 'SELECT token FROM c_api_member WHERE c_member_id = ?';
$params = array(intval($c_member_id));
if ($token = db_get_one($sql, $params)) {
return $token;
} else {
return db_api_insert_token($c_member_id);
}
}
示例7: smarty_resource_db_timestamp
function smarty_resource_db_timestamp($tpl_name, &$tpl_timestamp, &$smarty)
{
$sql = 'SELECT r_datetime FROM c_template WHERE name = ?';
$params = array(strval($tpl_name));
if ($res = db_get_one($sql, $params)) {
$tpl_timestamp = strtotime($res);
return true;
} else {
return false;
}
}
示例8: get_point
function get_point($c_member_id)
{
$sql = 'SELECT c_profile_id FROM c_profile WHERE name = \'PNE_POINT\'';
if (!($c_profile_id = db_get_one($sql))) {
return 0;
}
$sql = 'SELECT value FROM c_member_profile WHERE c_member_id = ? AND c_profile_id = ?';
$params = array(intval($c_member_id), intval($c_profile_id));
$point = db_get_one($sql, $params);
return intval($point);
}
示例9: session_set_user_projects
function session_set_user_projects()
{
$tbl_project = PROJECT_TBL;
$f_proj_id = $tbl_project . "." . PROJ_ID;
$f_proj_name = $tbl_project . "." . PROJ_NAME;
$f_proj_deleted = $tbl_project . "." . PROJ_DELETED;
$tbl_user = USER_TBL;
$f_user_id = $tbl_user . "." . USER_ID;
$f_username = $tbl_user . "." . USER_UNAME;
$f_tempest_admin = $tbl_user . "." . USER_ADMIN;
$f_user_default_project = $tbl_user . "." . USER_DEFAULT_PROJECT;
$tbl_proj_user_assoc = PROJECT_USER_ASSOC_TBL;
$f_proj_user_proj_id = $tbl_proj_user_assoc . "." . PROJ_USER_PROJ_ID;
$f_proj_user_user_id = $tbl_proj_user_assoc . "." . PROJ_USER_USER_ID;
$username = session_get_username();
global $db;
$q = "\tSELECT\t{$f_tempest_admin}\n\t\t\tFROM\t{$tbl_user}\n\t\t\tWHERE\t{$f_username} = '{$username}'";
# tempest administrator
if (db_get_one($db, $q) == "Y") {
$q = "\tSELECT\t{$f_proj_name}\n\t\t\t\tFROM\t{$tbl_project}\n\t\t\t\tWHERE {$f_proj_deleted} = 'N'\n\t\t\t\tORDER BY {$f_proj_name} ASC";
} else {
# tempest user
$q = "\tSELECT\t{$f_proj_name}\n\t\t\t\tFROM\t{$tbl_project}\n\t\t\t\tINNER JOIN {$tbl_proj_user_assoc} ON {$f_proj_id} = {$f_proj_user_proj_id}\n\t\t\t\tINNER JOIN {$tbl_user} ON {$f_proj_user_user_id} = {$f_user_id}\n\t\t\t\tWHERE {$f_username} = '{$username}'\n\t\t\t\tAND {$f_proj_deleted} = 'N'\n\t\t\t\tORDER BY {$f_proj_name} ASC";
}
$rows = db_fetch_array($db, db_query($db, $q));
$project_array = array();
foreach ($rows as $row) {
$project_array[] = $row[PROJ_NAME];
}
$_SESSION['s_user_projects'] = $project_array;
}
示例10: db_point_get_next_rank_point4rank_id
function db_point_get_next_rank_point4rank_id($c_rank_id)
{
$pre_point = db_point_get_rank_point4rank_id($c_rank_id);
$sql = 'SELECT point FROM c_rank WHERE point > ? ORDER BY point';
$params = array(intval($pre_point));
return db_get_one($sql, $params);
}
示例11: test_get_projectid
function test_get_projectid($testid)
{
global $db;
$f_project_id = TEST_PROJ_ID;
$f_test_tbl = TEST_TBL;
$f_test_id = TEST_ID;
$error = "SELECT COUNT({$f_project_id}) FROM {$f_test_tbl} WHERE {$f_test_id} = {$testid}";
$q = "SELECT DISTINCT {$f_project_id} FROM {$f_test_tbl} WHERE {$f_test_id} = {$testid}";
$return_id = db_get_one($db, $q);
$error_rs = db_get_one($db, $error);
if ($error_rs > 0) {
return $return_id;
} else {
return 0;
}
}
示例12: db_query
$db_testset_status = TS_TBL . "." . TS_STATUS;
$db_testset_signoff_by = TS_TBL . "." . TS_SIGNOFF_BY;
$db_testset_signoff_date = TS_TBL . "." . TS_SIGNOFF_DATE;
$db_testset_comments = TS_TBL . "." . TS_SIGNOFF_COMMENTS;
$db_testset_orderby = TS_TBL . "." . TS_ORDERBY;
$db_testset_build_id = TS_TBL . "." . TS_BUILD_ID;
$db_testset_lock_date = TS_TBL . "." . TS_LOCKCHANGE_DATE;
$db_testset_lock_by = TS_TBL . "." . TS_LOCK_BY;
$db_testset_lock_comment = TS_TBL . "." . TS_LOCK_COMMENT;
$q = "SELECT {$db_testset_id}, {$db_testset_build_id}, {$db_testset_name}, {$db_testset_date_created}, {$db_testset_desc}, {$db_testset_status}, {$db_testset_signoff_by}, {$db_testset_signoff_date}, {$db_testset_comments}, {$db_testset_orderby}, {$db_testset_lock_by}, {$db_testset_lock_date}, {$db_testset_lock_comment} FROM {$testset_tbl} WHERE {$db_testset_build_id} = '{$s_properties['build_id']}' ORDER BY {$db_testset_orderby} ASC" . NEWLINE;
$rs = db_query($db, $q);
$num = db_num_rows($db, $rs);
//print"$q". NEWLINE;
# QUERY FOR THE MAX TestSetOrderBy. USED IN TABLE FORMATTING
$q_orderby = "SELECT MAX({$db_testset_orderby}) FROM {$testset_tbl} WHERE {$db_testset_build_id} = '{$s_properties['build_id']}'" . NEWLINE;
$max_orderby = db_get_one($db, $q_orderby);
//->GetOne($q_orderby);
//print"$q_orderby<br>". NEWLINE;
if ($num > 0) {
//print"<H3 align=center>Test Plan for Release: <B> $row_build[ReleaseName] </B> and Build: <B> $row_build[BuildName] </B> </H3>". NEWLINE;
print "<p> The following Test Plan lists the different types/ stages of testing that are required in order to ensure that the application is adequately tested. Each stage of testing should be signed off to provide assurance and traceability that the application is ready to be released.</p>" . NEWLINE;
# simplify the url used later on the page for href
$query_string = "release_id=" . $s_properties['release_id'] . "&build_id=" . $s_properties['build_id'];
print "<br>" . NEWLINE;
print "<div align='center'>" . NEWLINE;
print "<table class='width100' rules='cols'>" . NEWLINE;
print "<tr class='tbl_header'>" . NEWLINE;
html_tbl_print_header(lang_get('id'));
if ($max_orderby > 1) {
html_tbl_print_header(lang_get('up'));
html_tbl_print_header(lang_get('down'));
示例13: admin_build_name_exists
function admin_build_name_exists($release_id, $build_name)
{
global $db;
$build_tbl = BUILD_TBL;
$f_build_name = $build_tbl . "." . BUILD_NAME;
$f_release_id = $build_tbl . "." . BUILD_REL_ID;
$q = "SELECT COUNT({$f_build_name})\n\t\t FROM {$build_tbl}\n\t\t WHERE {$f_build_name} = '{$build_name}'\n\t\t AND {$f_release_id} = '{$release_id}'";
$result = db_get_one($db, $q);
if (0 == $result) {
return false;
} else {
return true;
}
}
示例14: _getMessageCountYesterday
/**
* 前日のメッセージ件数
*/
function _getMessageCountYesterday()
{
$yesterday = date('Y-m-d H:i:s', mktime(0, 0, 0, date('m'), date('d') - 1, date('Y')));
$today = date('Y-m-d H:i:s', mktime(0, 0, 0, date('m'), date('d'), date('Y')));
$sql = 'SELECT COUNT(*) FROM c_message WHERE r_datetime >= ? AND r_datetime < ? AND is_send = 1';
$params = array($yesterday, $today);
return db_get_one($sql, $params);
}
示例15: user_reset_password
function user_reset_password($reset_link, $new_password)
{
$tbl_reset_pass = RESET_PASS_TBL;
$f_reset_pass_id = $tbl_reset_pass . "." . RESET_PASS_ID;
$f_reset_pass_link = $tbl_reset_pass . "." . RESET_PASS_LINK;
$f_reset_pass_user = $tbl_reset_pass . "." . RESET_PASS_USER;
$f_reset_pass_used = $tbl_reset_pass . "." . RESET_PASS_RESET_USED;
$f_reset_pass_expires = $tbl_reset_pass . "." . RESET_PASS_EXPIRES;
$tbl_user = USER_TBL;
$f_user_id = $tbl_user . "." . USER_ID;
$f_username = $tbl_user . "." . USER_UNAME;
$f_email = $tbl_user . "." . USER_EMAIL;
$f_first_name = $tbl_user . "." . USER_FNAME;
$f_last_name = $tbl_user . "." . USER_LNAME;
$f_phone = $tbl_user . "." . USER_PHONE;
$f_password = $tbl_user . "." . USER_PWORD;
$f_tempest_admin = $tbl_user . "." . USER_ADMIN;
$f_user_default_project = $tbl_user . "." . USER_DEFAULT_PROJECT;
global $db;
# fetch the users email address where the record has not expired,
# and reset link has not already been accessed
$current_date = date_get_short_dt();
$q = "\tSELECT {$f_reset_pass_user}\n\t\t\tFROM {$tbl_reset_pass}\n\t\t\tWHERE {$f_reset_pass_link} = '{$reset_link}'\n\t\t\t\tAND {$f_reset_pass_expires} > '{$current_date}'\n\t\t\t\tAND {$f_reset_pass_used} = 'N'";
$email = db_get_one($db, $q);
# if a users email address was returned
if ($email) {
# mark the reset link as used
$q = "\tUPDATE {$tbl_reset_pass}\n\t\t\t\tSET {$f_reset_pass_used} = 'Y'\n\t\t\t\tWHERE {$f_reset_pass_link} = '{$reset_link}'";
db_query($db, $q);
# encrypt password
if (LOGIN_METHOD == 'MD5') {
$new_password = auth_process_plain_password($new_password);
}
# change the users password
$q = "\tUPDATE {$tbl_user}\n\t\t\t\tSET {$f_password} = '{$new_password}'\n\t\t\t\tWHERE {$f_email} = '{$email}'";
db_query($db, $q);
}
return $email;
}