本文整理汇总了PHP中db_free_result函数的典型用法代码示例。如果您正苦于以下问题:PHP db_free_result函数的具体用法?PHP db_free_result怎么用?PHP db_free_result使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了db_free_result函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: is_t_complete
/**
* @param $subject_id
* @param $event_id
* @return bool
* Determine whether all surveys for this time point are complete.
*/
function is_t_complete($subject_id, $event_id) {
if (isset($subject_id) && isset($event_id)) {
global $Proj;
$fields = array();
$complete = true;
$surveys_query = "SELECT form_name FROM redcap_surveys WHERE project_id = '$Proj->project_id'";
$surveys_result = db_query($surveys_query);
if ($surveys_result) {
while ($survey_row = db_fetch_array($surveys_result)) {
if ($Proj->validateFormEvent($survey_row['form_name'], $event_id)) {
$fields[] = $survey_row['form_name'] . '_complete';
}
}
$data = REDCap::getData('array', $subject_id, $fields, $event_id);
foreach ($data[$subject_id][$event_id] AS $key => $value) {
if ($value != '2') {
$complete = false;
}
}
db_free_result($surveys_result);
return $complete;
}
} else {
return false;
}
}
示例2: TitleMask
/**
@param mask_group - if an array, then will use first group that has values defined.
*/
function TitleMask($mask_group = NULL)
{
if ($mask_group !== NULL) {
if (is_array($mask_group)) {
while (list(, $group) = each($mask_group)) {
$results = fetch_title_display_mask_rs($group);
if ($results) {
$this->_mask_group = $group;
break;
}
}
} else {
$this->_mask_group = $mask_group;
$results = fetch_title_display_mask_rs($mask_group);
}
$default_found = FALSE;
if ($results) {
while ($title_display_mask_r = db_fetch_assoc($results)) {
if ($title_display_mask_r['s_item_type_group'] == '*' && $title_display_mask_r['s_item_type'] == '*') {
$default_found = TRUE;
}
$this->_title_mask_rs[] = $title_display_mask_r;
}
db_free_result($results);
}
// fall back on a default if none defined
if (!$default_found) {
$this->_title_mask_rs[] = array('s_item_type_group' => '*', 's_item_type' => '*', 'display_mask' => '{title}');
}
}
}
示例3: get_announcements_block
function get_announcements_block()
{
$buffer = '';
if (is_user_granted_permission(PERM_ADMIN_ANNOUNCEMENTS)) {
// include a login warning if user password and email are still the defaults
if (get_opendb_session_var('user_id') == 'admin') {
$announcements_rs = get_admin_announcements_rs();
while (list(, $announcement_r) = each($announcements_rs)) {
$buffer .= "<li><h4>" . $announcement_r['heading'] . "</h4>\n\t\t\t\t\t<p class=\"content\">" . $announcement_r['message'] . "<a class=\"adminLink\" href=\"" . $announcement_r['link'] . "\">" . $announcement_r['link_text'] . "</a></p>";
}
}
}
if (get_opendb_config_var('welcome.announcements', 'enable') !== FALSE && is_user_granted_permission(PERM_VIEW_ANNOUNCEMENTS)) {
$results = fetch_announcement_rs('submit_on', 'DESC', 0, get_opendb_config_var('welcome.announcements', 'display_count'), 'Y', 'Y');
if ($results) {
while ($announcement_r = db_fetch_assoc($results)) {
$buffer .= "<li><h4>" . $announcement_r['title'] . "</h4>";
$buffer .= "<small class=\"submitDate\">" . get_localised_timestamp(get_opendb_config_var('welcome.announcements', 'datetime_mask'), $announcement_r['submit_on']) . "</small>";
$buffer .= "<p class=\"content\">" . nl2br($announcement_r['content']) . "</p></li>";
}
db_free_result($results);
}
}
if (strlen($buffer) > 0) {
return "\n<div id=\"announcements\">" . "<h3>" . get_opendb_lang_var('announcements') . "</h3>" . "\n<ul>" . $buffer . "\n</ul></div>";
} else {
return NULL;
}
}
示例4: checkban
function checkban(string $login, bool $connect = false) : bool
{
global $session;
$accounts = db_prefix('accounts');
$bans = db_prefix('accounts');
$today = date('Y-m-d');
$sql = db_query("SELECT lastip, uniquid, banoverride, superuser FROM {$accounts}\n WHERE login = '{$login}'");
$row = db_fetch_assoc($sql);
if ($row['banoverride'] || $row['superuser'] & ~SU_DOESNT_GIVE_GROTTO) {
return false;
}
db_free_result($sql);
$sql = db_query("SELECT * FROM {$bans}\n WHERE (\n (ipfilter = '{$row['lastip']}' OR ipfilter = '{$_SERVER['REMOTE_ADDR']}')\n OR (uniqueid = '{$row['uniqueid']}' OR uniqueid = '{$_COOKIE['lgi']}')\n )\n AND (banexpire = '000-00-00' OR banexpire >= '{$today}')");
if (db_num_rows($sql) > 0) {
if ($connect) {
$session = [];
tlschema('ban');
$session['message'] .= translate_inline('`n`4You fall under a ban currently in place on this website:');
while ($row = db_fetch_assoc($sql)) {
$session['message'] .= "`n{$row['banreason']}`n";
if ($row['banexpire'] == '0000-00-00') {
$session['message'] .= translate_inline("`\$This ban is permanent!`0");
} else {
$session['message'] .= sprintf_translate("`^This ban will be removed `\$after`^ %s.`0", date("M d, Y", strtotime($row['banexpire'])));
}
db_query("UPDATE {$bans}\n SET lasthit = '{$today} 00:00:00'\n WHERE ipfilter = '{$row['ipfilter']}'\n AND uniqueid = '{$row['uniqueid']}'\n ");
}
$session['message'] .= translate_inline("`n`4If you wish, you may appeal your ban with the petition link.");
tlschema();
header('Location: home.php');
}
return true;
}
return false;
}
示例5: cw_review_get_management_reviews_count
function cw_review_get_management_reviews_count($where = "", $orderby = "", $limit = "")
{
$count_query = cw_review_get_reviews_query($where, $orderby, $limit);
$_res = db_query($count_query);
$total_items = db_num_rows($_res);
db_free_result($_res);
return $total_items;
}
示例6: site_hminfo_exists
function site_hminfo_exists($id)
{
$query = "SELECT 'x' FROM site_hminfo WHERE id = {$id}";
$result = db_query($query);
if ($result && db_num_rows($result) > 0) {
db_free_result($result);
return TRUE;
}
//else
return FALSE;
}
示例7: do_forced_nav
function do_forced_nav($anonymous, $overrideforced)
{
global $baseaccount, $session, $REQUEST_URI;
rawoutput("<!--\nAllowAnonymous: " . ($anonymous ? "True" : "False") . "\nOverride Forced Nav: " . ($overrideforced ? "True" : "False") . "\n-->");
if (isset($session['loggedin']) && $session['loggedin']) {
$sql = "SELECT * FROM " . db_prefix("accounts") . " WHERE acctid = '" . $session['user']['acctid'] . "'";
$result = db_query($sql);
if (db_num_rows($result) == 1) {
$session['user'] = db_fetch_assoc($result);
$baseaccount = $session['user'];
$session['bufflist'] = unserialize($session['user']['bufflist']);
if (!is_array($session['bufflist'])) {
$session['bufflist'] = array();
}
$session['user']['dragonpoints'] = unserialize($session['user']['dragonpoints']);
$session['user']['prefs'] = unserialize($session['user']['prefs']);
if (!is_array($session['user']['dragonpoints'])) {
$session['user']['dragonpoints'] = array();
}
if (is_array(unserialize($session['user']['allowednavs']))) {
$session['allowednavs'] = unserialize($session['user']['allowednavs']);
} else {
$session['allowednavs'] = array($session['user']['allowednavs']);
}
if (!$session['user']['loggedin'] || date("U") - strtotime($session['user']['laston']) > getsetting("LOGINTIMEOUT", 900)) {
$session = array();
redirect("index.php?op=timeout", "Account not logged in but session thinks they are.");
}
} else {
$session = array();
$session['message'] = translate_inline("`4Error, your login was incorrect`0", "login");
redirect("index.php", "Account Disappeared!");
}
db_free_result($result);
//check the nav exists in the session's allowednavs array
if (isset($session['allowednavs'][$REQUEST_URI]) && $session['allowednavs'][$REQUEST_URI] && $overrideforced !== true) {
//The nav is fine
//clear the navs - more navs will be added as the script the player is currently viewing loads and executes
$session['allowednavs'] = array();
} else {
if ($overrideforced !== true) {
//This nav is not fine at all. Redirect the player to badnav.php.
$session['badnav'] = 1;
redirect("badnav.php", "Navigation not allowed to {$REQUEST_URI}");
}
}
} else {
if (!$anonymous) {
$session['message'] = translate_inline("You are not logged in, this may be because your session timed out.", "login");
redirect("index.php?op=timeout&nli=true", "Not logged in: {$REQUEST_URI}");
}
}
}
开发者ID:Beeps,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:53,代码来源:forcednavigation.php
示例8: fetch_s_address_type_r
function fetch_s_address_type_r($s_address_type)
{
$query = "SELECT s_address_type, display_order, description, closed_ind FROM s_address_type WHERE s_address_type = '{$s_address_type}'";
$result = db_query($query);
if ($result && db_num_rows($result) > 0) {
$found = db_fetch_assoc($result);
db_free_result($result);
return $found;
}
//else
return FALSE;
}
示例9: db_session_read
function db_session_read($SID)
{
$query = "SELECT value FROM php_session " . " WHERE SID = '{$SID}' AND " . " expiration > " . time();
$result = db_query($query);
if ($result && db_num_rows($result) > 0) {
$found = db_fetch_assoc($result);
db_free_result($result);
return $found['value'];
} else {
return '';
}
}
示例10: fetch_max_site_plugin_link_order_no
function fetch_max_site_plugin_link_order_no($site_type)
{
$query = "SELECT MAX(order_no) as max_order_no " . "FROM s_site_plugin_link " . "WHERE site_type = '{$site_type}'";
$result = db_query($query);
if ($result && db_num_rows($result) > 0) {
$site_plugin_r = db_fetch_assoc($result);
db_free_result($result);
return $site_plugin_r['max_order_no'];
}
//else
return FALSE;
}
示例11: is_exists_s_item_listing_conf
/**
If called from insert process, the table has been locked
*/
function is_exists_s_item_listing_conf($silc_id)
{
if (strlen($silc_id) > 0) {
$query = "SELECT 'x' FROM s_item_listing_conf WHERE id = {$silc_id}";
$result = db_query($query);
if ($result && db_num_rows($result) > 0) {
db_free_result($result);
return TRUE;
}
}
//else
return FALSE;
}
示例12: fetch_s_item_type_group_cnt
function fetch_s_item_type_group_cnt()
{
$query = "SELECT count('x') as count FROM s_item_type_group";
$result = db_query($query);
if ($result && db_num_rows($result) > 0) {
$found = db_fetch_assoc($result);
db_free_result($result);
if ($found !== FALSE) {
return (int) $found['count'];
}
}
return FALSE;
}
示例13: setCategories
function setCategories($categories)
{
query('DELETE FROM ' . prefix('news2cat') . ' WHERE `news_id`=' . $this->getID());
$result = query("SELECT * FROM " . prefix('news_categories') . " ORDER BY titlelink");
if ($result) {
while ($cat = db_fetch_assoc($result)) {
if (in_array($cat['titlelink'], $categories)) {
query("INSERT INTO " . prefix('news2cat') . " (cat_id, news_id) VALUES ('" . $cat['id'] . "', '" . $this->getID() . "')");
}
}
db_free_result($result);
}
}
示例14: is_exists_borrowed_items_for_status_type
function is_exists_borrowed_items_for_status_type($s_status_type, $borrowed_items_only = FALSE)
{
$query = "SELECT 'x' " . "FROM item_instance ii, borrowed_item bi " . "WHERE ii.item_id = bi.item_id AND " . "ii.instance_no = bi.instance_no AND " . "ii.s_status_type = '{$s_status_type}' ";
if ($borrowed_items_only) {
$query .= "AND bi.status = 'B'";
}
$result = db_query($query);
if ($result && db_num_rows($result) > 0) {
db_free_result($result);
return TRUE;
}
//else
return FALSE;
}
示例15: fetch_interest_level
function fetch_interest_level($item_id, $instance_no, $user_id)
{
$query = "SELECT level" . " FROM user_item_interest i" . " WHERE i.item_id = {$item_id} AND i.instance_no = {$instance_no} AND i.user_id = '{$user_id}'";
// opendb_logger(OPENDB_LOG_INFO, __FILE__, __FUNCTION__, "query:" . $query);
$result = db_query($query);
if ($result && db_num_rows($result) > 0) {
$found = db_fetch_assoc($result);
db_free_result($result);
// opendb_logger(OPENDB_LOG_INFO, __FILE__, __FUNCTION__, "level:" . $found['level']);
return trim($found['level']);
} else {
return FALSE;
}
}