本文整理汇总了PHP中db_fetch_assoc函数的典型用法代码示例。如果您正苦于以下问题:PHP db_fetch_assoc函数的具体用法?PHP db_fetch_assoc怎么用?PHP db_fetch_assoc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了db_fetch_assoc函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: api_data_source_remove_multi
function api_data_source_remove_multi($local_data_ids)
{
$ids_to_delete = "";
$dtd_ids_to_delete = "";
$i = 0;
$j = 0;
if (sizeof($local_data_ids)) {
foreach ($local_data_ids as $local_data_id) {
if ($i == 0) {
$ids_to_delete .= $local_data_id;
} else {
$ids_to_delete .= ", " . $local_data_id;
}
$i++;
}
$data_template_data_ids = db_fetch_assoc("SELECT id\n\t\t\tFROM data_template_data\n\t\t\tWHERE local_data_id IN ({$ids_to_delete})");
if (sizeof($data_template_data_ids)) {
foreach ($data_template_data_ids as $data_template_data_id) {
if ($j == 0) {
$dtd_ids_to_delete .= $data_template_data_id["id"];
} else {
$dtd_ids_to_delete .= ", " . $data_template_data_id["id"];
}
$j++;
}
db_execute("DELETE FROM data_template_data_rra WHERE data_template_data_id IN ({$dtd_ids_to_delete})");
db_execute("DELETE FROM data_input_data WHERE data_template_data_id IN ({$dtd_ids_to_delete})");
}
db_execute("DELETE FROM data_template_data WHERE local_data_id IN ({$ids_to_delete})");
db_execute("DELETE FROM data_template_rrd WHERE local_data_id IN ({$ids_to_delete})");
db_execute("DELETE FROM poller_item WHERE local_data_id IN ({$ids_to_delete})");
db_execute("DELETE FROM data_local WHERE id IN ({$ids_to_delete})");
}
}
示例2: __perform_refresh_thumbnails_batch
function __perform_refresh_thumbnails_batch()
{
if ($this->_batchlimit > 0) {
$results = fetch_file_cache_rs('ITEM');
if ($results) {
while ($file_cache_r = db_fetch_assoc($results)) {
// its not a case of only a thumbnail, if not even the source exists
if (file_cache_get_cache_file($file_cache_r) !== FALSE && file_cache_get_cache_file_thumbnail($file_cache_r) === FALSE) {
// in this case we want to refresh the URL, so TRUE as last parameter idicates overwrite
if (file_cache_save_thumbnail_file($file_cache_r, $errors)) {
$this->_processed++;
} else {
$this->_failures++;
}
// don't process anymore this time around.
if ($this->_processed >= $this->_batchlimit) {
break;
}
}
}
db_free_result($results);
}
}
$this->_remaining = fetch_file_cache_missing_thumbs_cnt('ITEM');
}
示例3: marriage_lovedrinks
function marriage_lovedrinks()
{
$z = 2;
$s = get_module_setting('loveDrinksAdd');
if (is_module_installed('drinks') && $s < $z) {
$sql = array();
$ladd = array();
if ($s < 1) {
// We use 'lessthan' so more drinks can be packaged with this
$sql[] = "INSERT INTO " . db_prefix("drinks") . " VALUES (0, 'Love Brew', 1, 25, 5, 0, 0, 0, 20, 0, 5, 15, 0.0, 0, 0, 'Cedrik reaches under the bar, pulling out a purple cupid shaped bottle... as he pours it into a crystalline glass, the glass shines and he puts a pineapple within the liquid... \"Here, have a Love Brew..\" says Cedrik.. and as you try it, you feel uplifted!', '`%Love Brew', 12, 'You remember love..', 'Despair sets in.', '1.1', '.9', '1.5', '0', '', '', '')";
$ladd[] = "Love Brew";
}
if ($s < 2) {
// We use 'lessthan' so more drinks can be packaged with this
$sql[] = "INSERT INTO " . db_prefix("drinks") . " VALUES (0, 'Heart Mist', 1, 25, 5, 0, 0, 0, 20, 0, 5, 15, 0.0, 0, 0, 'Cedrik grabs for a rather garish looking bottle on the shelf behind him... as he pours it into a large yellow mug, the porcelain seems to dissolve.. ooh er.. he puts a tomato within the sweet smelling gunk... \"Here, have a Heart Mist..\" says Cedrik.. and as you try it, you see symbols of love!', '`\$Heart Mist', 18, '`%Misty hearts fly around you..', '`#The sky falls...', '1.1', '.9', '1.5', '0', '', '', '')";
$ladd[] = "Heart Misy";
}
foreach ($sql as $val) {
db_query($val);
}
foreach ($ladd as $val) {
$sql = "SELECT * FROM " . db_prefix("drinks") . " WHERE name='{$val}' ORDER BY costperlevel";
$result = db_query($sql);
$row = db_fetch_assoc($result);
set_module_objpref('drinks', $row['drinkid'], 'loveOnly', 1, 'marriage');
}
set_module_setting('loveDrinksAdd', $z);
output("`n`c`b`^Marriage Module - Drinks have been added to the Loveshack`0`b`c");
} elseif (!is_module_active('drinks')) {
set_module_setting('loveDrinksAdd', 0);
}
}
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:32,代码来源:lovedrinks.php
示例4: getlabeltree
function getlabeltree()
{
$root = array();
$root['id'] = 'root';
$root['name'] = __('Labels');
$root['items'] = array();
$result = db_query($this->link, "SELECT *\n\t\t\tFROM ttrss_labels2\n\t\t\tWHERE owner_uid = " . $_SESSION["uid"] . "\n\t\t\tORDER BY caption");
while ($line = db_fetch_assoc($result)) {
$label = array();
$label['id'] = 'LABEL:' . $line['id'];
$label['bare_id'] = $line['id'];
$label['name'] = $line['caption'];
$label['fg_color'] = $line['fg_color'];
$label['bg_color'] = $line['bg_color'];
$label['type'] = 'label';
$label['checkbox'] = false;
array_push($root['items'], $label);
}
$fl = array();
$fl['identifier'] = 'id';
$fl['label'] = 'name';
$fl['items'] = array($root);
print json_encode($fl);
return;
}
示例5: handleOption
function handleOption($option, $currentValue)
{
$count = 0;
$result = query('SELECT * FROM ' . prefix('plugin_storage') . ' WHERE `type`="externalFeed" ORDER BY `aux`');
if ($result) {
$list = array();
while ($row = db_fetch_assoc($result)) {
$count++;
$key = $row['data'];
$site = $row['aux'];
?>
<div>
<label><?php
printf(gettext('<em><strong>%1$s</strong></em> key=%2$s'), $site, $key);
?>
<input type="checkbox" name="externalFeed_delete_<?php
echo $site;
?>
" /></label>
</div>
<?php
}
}
if (!$count) {
echo gettext('No sites registered');
}
}
示例6: 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;
}
}
示例7: 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}');
}
}
}
示例8: scrapbots_get_armies
function scrapbots_get_armies($defenderid, $attackerid)
{
global $session;
//get attackers
$sql = "SELECT id,owner,name,activated,hitpoints,brains,brawn,briskness,junglefighter,retreathp FROM " . db_prefix("scrapbots") . " WHERE owner = {$attackerid}";
$result = db_query($sql);
$attacker = array();
for ($i = 0; $i < db_num_rows($result); $i++) {
$attacker[$i] = db_fetch_assoc($result);
}
$sql = "SELECT id,owner,name,activated,hitpoints,brains,brawn,briskness,junglefighter,retreathp FROM " . db_prefix("scrapbots") . " WHERE owner = {$defenderid}";
$result = db_query($sql);
$defender = array();
for ($i = 0; $i < db_num_rows($result); $i++) {
$defender[$i] = db_fetch_assoc($result);
}
debug("Debugging Attacker");
debug($attacker);
debug("Debugging Defender");
debug($defender);
$armies = array("attacker" => $attacker, "defender" => $defender);
//Set starting vals
$armies['attacker']['retreatpct'] = get_module_pref("retreatpct", "scrapbots", $attackerid);
$armies['defender']['retreat'] = get_module_pref("retreatpct", "scrapbots", $defenderid);
debug("Debugging Armies");
debug($armies);
return $armies;
}
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:28,代码来源:battle.php
示例9: monsterkills_run
function monsterkills_run()
{
page_header("Most Monster Kills");
$acc = db_prefix("accounts");
$mp = db_prefix("module_userprefs");
$sql = "SELECT {$acc}.name AS name,\r\n\t\t{$acc}.acctid AS acctid,\r\n\t\t{$mp}.value AS kills,\r\n\t\t{$mp}.userid FROM {$mp} INNER JOIN {$acc}\r\n\t\tON {$acc}.acctid = {$mp}.userid \r\n\t\tWHERE {$mp}.modulename = 'monsterkills' \r\n\t\tAND {$mp}.setting = 'kills' \r\n\t\tAND {$mp}.value > 0 ORDER BY ({$mp}.value+0)\t\r\n\t\tDESC limit " . get_module_setting("list") . "";
$result = db_query($sql);
$rank = translate_inline("Kills");
$name = translate_inline("Name");
output("`n`b`c`@Most`\$ Monster `@Kills`n`n`c`b");
rawoutput("<table border='0' cellpadding='2' cellspacing='1' align='center'>");
rawoutput("<tr class='trhead'><td align=center>{$name}</td><td align=center>{$rank}</td></tr>");
for ($i = 0; $i < db_num_rows($result); $i++) {
$row = db_fetch_assoc($result);
if ($row['name'] == $session['user']['name']) {
rawoutput("<tr class='trhilight'><td>");
} else {
rawoutput("<tr class='" . ($i % 2 ? "trdark" : "trlight") . "'><td align=left>");
}
output_notl("%s", $row['name']);
rawoutput("</td><td align=right>");
output_notl("%s", $row['kills']);
rawoutput("</td></tr>");
}
rawoutput("</table>");
addnav("Back to HoF", "hof.php");
villagenav();
page_footer();
}
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:29,代码来源:monsterkills.php
示例10: get_typeid
function get_typeid($modulename)
{
$sql = "SELECT typeid FROM " . db_prefix("dwellingtypes") . " WHERE module='{$modulename}'";
$res = db_query($sql);
$row = db_fetch_assoc($res);
return $row['typeid'];
}
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:7,代码来源:func.php
示例11: getProductByBrand
function getProductByBrand($brandID)
{
$sql = '
select
categoryID,
name,
productID,
default_picture,
sort_order,
enabled,
product_code,
uri,
uri_opt_val
' . convert_prices() . '
FROM ' . PRODUCTS_TABLE . '
WHERE categoryID = ' . (int) $brandID . '
ORDER BY name';
$q = db_query($sql);
$result = array();
while ($row = db_fetch_assoc($q)) {
_setPictures($row);
$row['url'] = fu_make_url($row);
$result[] = $row;
}
return $result;
}
示例12: bioextension_dohook
function bioextension_dohook($hookname, $args)
{
global $session;
if ($hookname == "bioinfo") {
$sql = "SELECT donation FROM " . db_prefix("accounts") . " WHERE acctid = '" . $args['acctid'] . "'";
$result = db_query($sql);
$row = db_fetch_assoc($result);
if ($row['donation'] >= get_module_setting("threshhold")) {
$bio = get_module_pref("user_extendedbio", "bioextension", $args['acctid']);
$link = get_module_pref("user_extlink", "bioextension", $args['acctid']);
$bio = str_replace(chr(13), "`n", $bio);
$bio = stripslashes($bio);
output("`0%s`n`n", $bio);
if (substr($link, 0, 5) == "http:") {
rawoutput("<a href=\"" . $link . "\">Player's webpage</a><br /><br />");
}
}
} else {
if ($hookname == "footer-prefs") {
$bio = get_module_pref("user_extendedbio");
$limit = get_module_setting("charlimit");
if (strlen($bio) > $limit) {
output("`c`4`bWARNING`b`0`c`nYour Extended Bio is oversized by %s characters. If you navigate away from this page, your Extended Bio will have %s characters indiscriminately cut from the end. Please edit and re-save your Extended Bio to avoid cuts.", strlen($bio) - $limit, strlen($bio) - $limit);
$bio = substr($bio, 0, $limit);
set_module_pref("user_extendedbio", $bio);
}
}
}
return $args;
}
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:30,代码来源:bioextension.php
示例13: lovers_install
function lovers_install()
{
module_addhook("newday");
module_addhook("inn");
$sql = "DESCRIBE " . db_prefix("accounts");
$result = db_query($sql);
while ($row = db_fetch_assoc($result)) {
if ($row['Field'] == "seenlover") {
$sql = "SELECT seenlover,acctid FROM " . db_prefix("accounts") . " WHERE seenlover>0";
$result1 = db_query($sql);
debug("Migrating seenlover.`n");
while ($row1 = db_fetch_assoc($result1)) {
$sql = "INSERT INTO " . db_prefix("module_userprefs") . " (modulename,setting,userid,value) VALUES ('lovers','seenlover',{$row1['acctid']},{$row1['seenlover']})";
db_query($sql);
}
//end while
debug("Dropping seenlover column from the user table.`n");
$sql = "ALTER TABLE " . db_prefix("accounts") . " DROP seenlover";
db_query($sql);
//drop it from the user's session too.
unset($session['user']['seenlover']);
}
//end if
}
//end while
return true;
}
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:27,代码来源:lovers.php
示例14: api_poller_list
function api_poller_list($filter_array = "", $current_page = 0, $rows_per_page = 0) {
require_once(CACTI_BASE_PATH . "/lib/poller/poller_form.php");
$sql_where = "";
/* validation and setup for the WHERE clause */
if ((is_array($filter_array)) && (sizeof($filter_array) > 0)) {
/* validate each field against the known master field list */
$field_errors = api_poller_fields_validate(sql_filter_array_to_field_array($filter_array));
/* if a field input error has occured, register the error in the session and return */
if (sizeof($field_errors) > 0) {
field_register_error($field_errors);
return false;
/* otherwise, form an SQL WHERE string using the filter fields */
}else{
$sql_where = sql_filter_array_to_where_string($filter_array, api_poller_form_list(), true);
}
}
$sql_limit = "";
/* validation and setup for the LIMIT clause */
if ((is_numeric($current_page)) && (is_numeric($rows_per_page)) && (!empty($current_page)) && (!empty($rows_per_page))) {
$sql_limit = "LIMIT " . ($rows_per_page * ($current_page - 1)) . ",$rows_per_page";
}
return db_fetch_assoc("SELECT
*
FROM poller
$sql_where
ORDER BY poller.name
$sql_limit");
}
示例15: 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;
}