本文整理汇总了PHP中db_num_rows函数的典型用法代码示例。如果您正苦于以下问题:PHP db_num_rows函数的具体用法?PHP db_num_rows怎么用?PHP db_num_rows使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了db_num_rows函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hasRun
/**
* Returns the status of the update
*
* @return boolean True if update does not need to be run.
*/
function hasRun()
{
// check for template4
$query = "\n\t\t\tSELECT\n\t\t\t\tsite_id\n\t\t\tFROM\n\t\t\t\tslot\n\t\t\t\t\tINNER JOIN\n\t\t\t\tsite\n\t\t\t\t\tON\n\t\t\t\t\t\tFK_site = site_id\n\t\t\tWHERE\n\t\t\t\tslot_name = 'template4'\n\t\t";
$r = db_query($query);
if (db_num_rows($r)) {
$this->fourExists = TRUE;
} else {
print "\nTemplate 4 doesn't exist<br />";
}
// check for template5
$query = "\n\t\t\tSELECT\n\t\t\t\tsite_id\n\t\t\tFROM\n\t\t\t\tslot\n\t\t\t\t\tINNER JOIN\n\t\t\t\tsite\n\t\t\t\t\tON\n\t\t\t\t\t\tFK_site = site_id\n\t\t\tWHERE\n\t\t\t\tslot_name = 'template5'\n\t\t";
$r = db_query($query);
if (db_num_rows($r)) {
$this->fiveExists = TRUE;
} else {
print "\nTemplate 5 doesn't exist<br />";
}
// return results
if ($this->fourExists && $this->fiveExists) {
return TRUE;
} else {
return FALSE;
}
}
示例2: 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
示例3: importOpml
function importOpml()
{
header("Content-Type: text/html");
# required for iframe
print __("If you have imported labels and/or filters, you might need to reload preferences to see your new data.") . "</p>";
print "<div class=\"prefFeedOPMLHolder\">";
$owner_uid = $_SESSION["uid"];
db_query($this->link, "BEGIN");
/* create Imported feeds category just in case */
$result = db_query($this->link, "SELECT id FROM\n\t\t\tttrss_feed_categories WHERE title = 'Imported feeds' AND\n\t\t\towner_uid = '{$owner_uid}' LIMIT 1");
if (db_num_rows($result) == 0) {
db_query($this->link, "INSERT INTO ttrss_feed_categories\n\t\t\t\t(title,owner_uid)\n\t\t\t\t\tVALUES ('Imported feeds', '{$owner_uid}')");
}
db_query($this->link, "COMMIT");
/* Handle OPML import by DOMXML/DOMDocument */
print "<ul class='nomarks'>";
require_once "opml.php";
opml_import_domdoc($this->link, $owner_uid);
print "</ul>";
print "</div>";
print "<div align='center'>";
print "<button dojoType=\"dijit.form.Button\"\n\t\t\tonclick=\"dijit.byId('opmlImportDlg').execute()\">" . __('Close this window') . "</button>";
print "</div>";
print "</div>";
//return;
}
示例4: 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
示例5: payment_main
function payment_main()
{
$user = user_isonline();
if ($user === false) {
payment_die(_('Please login before checkout'));
}
$sid = @$_GET['serviceid'];
$sid = (int) $sid;
$sql = "SELECT * FROM service WHERE id={$sid}";
$res = db_query($sql);
if ($res == false || db_num_rows($res) == 0) {
payment_die(_('We have no this service'));
}
$arr = db_fetch_array($res);
$orderarr = order_new($sid);
if ($orderarr == false) {
payment_die(_('Checkout fail, please contact us for help'));
}
/// 使用 PayPal 进行支付
$ret = paypal_new_payment($orderarr['orderid'], $amount);
if ($ret == false) {
payment_die(_('Checkout fail, please contact us for help'));
}
payment_redirect(PAYPAL_REDIRECTURL . '?token=' . $ret['token']);
}
示例6: tents_dohook
function tents_dohook($hookname, $args)
{
global $session;
switch ($hookname) {
case "worldnav":
$ploc = get_module_pref("worldXYZ", "worldmapen");
$sql = "SELECT owner,type,data FROM " . db_prefix("structures") . " WHERE location = {$ploc}";
$result = db_query($sql);
for ($i = 0; $i < db_num_rows($result); $i++) {
//send structure through module hooks
}
// $chats = unserialize(get_module_setting("placedchats"));
// $ploc = get_module_pref("worldXYZ","worldmapen");
// $chatarea = 0;
// if (!is_array($chats)) {
// $chats = array();
// }
// foreach($chats AS $key => $vals){
// if ($ploc == $vals['loc']['x'].",".$vals['loc']['y'].",1"){
// output("`0There's a little tent here.`n");
// addnav("Investigate Tent","runmodule.php?module=tents&xyz=".$ploc);
// $chatarea = 1;
// break;
// }
// }
// if (!$chatarea){
// }
break;
}
return $args;
}
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:31,代码来源:tents.php
示例7: modules
function modules()
{
global $list_prefix;
$MAIN = loadtmplate("main");
//lets get our module list from the DB.
$sql = "SELECT * FROM " . $list_prefix . "config WHERE `key` = 'indexmodule' ORDER BY `order`;";
$result = db_query($sql);
if ($result) {
//lets see how many modules we have and initialize our variables.
$rows = db_num_rows($result);
$i = 0;
$CONTENT = "";
$perpage = 3;
//lets read our modules, load them, add their content to our main content.
while ($i < $rows) {
$row = db_fetch_array($result);
include_once $row['value'] . ".mod.php";
$CONTENT .= "<H2>" . $MOD['title'] . "</H2><BR>\r\n";
$CONTENT .= $MOD['content'];
$i++;
}
//lets insert our content into the template.
$WORK = insert_into_template($MAIN, "{CONTENT}", $CONTENT);
$WORK = filltemplate($WORK, "{SITENAME}");
//this is an ugly hack but it works.
//when we output this lets make sure that the output is stripped of any template elements that are not used.
printf("%s", striptemplate($WORK));
}
}
示例8: sql_emailExists
function sql_emailExists($email)
{
/* returns 1 if the email address exists otherwise 0 */
global $CFG;
$qid = db_query("SELECT 1 FROM {$CFG->tbl_person} WHERE PersonEmail = '{$email}'");
return db_num_rows($qid);
}
示例9: friendlist_search
function friendlist_search()
{
global $session;
$n = httppost("n");
rawoutput("<form action='runmodule.php?module=friendlist&op=search' method='POST'>");
addnav("", "runmodule.php?module=friendlist&op=search");
if ($n != "") {
$string = "%";
for ($x = 0; $x < strlen($n); $x++) {
$string .= substr($n, $x, 1) . "%";
}
$sql = "SELECT name,dragonkills,acctid FROM " . db_prefix("accounts") . " WHERE name LIKE '%{$string}%' AND acctid<>" . $session['user']['acctid'] . " AND locked=0 ORDER BY level,dragonkills";
$result = db_query($sql);
if (db_num_rows($result) > 0) {
$ignored = rexplode(get_module_pref('ignored'));
$friends = rexplode(get_module_pref('friends'));
$request = rexplode(get_module_pref('request'));
$iveignored = rexplode(get_module_pref('iveignored'));
output("`@These users were found:`n");
rawoutput("<table style='width:60%;text-align:center;' cellpadding='3' cellspacing='0' border='0'>");
rawoutput("<tr class='trhead'><td>" . translate_inline("Name") . "</td><td>" . translate_inline("Operations") . "</td></tr>");
for ($i = 0; $i < db_num_rows($result); $i++) {
$row = db_fetch_assoc($result);
rawoutput("<tr class='" . ($i % 2 ? "trlight" : "trdark") . "'><td>");
output_notl($row['name']);
rawoutput("</td><td>");
if (in_array($row['acctid'], $ignored)) {
$info = translate_inline("This user has ignored you.");
$info .= " [<a href='runmodule.php?module=friendlist&op=ignore&ac=" . $row['acctid'] . "' class='colDkGreen'>" . translate_inline("Ignore") . "</a>]";
addnav("", "runmodule.php?module=friendlist&op=ignore&ac=" . $row['acctid']);
} elseif (in_array($row['acctid'], $friends)) {
$info = translate_inline("This user is already in your list.");
} elseif (in_array($row['acctid'], $request)) {
$info = translate_inline("This user has already requested to you.");
} else {
if (in_array($row['acctid'], $iveignored)) {
$info = "[<a href='runmodule.php?module=friendlist&op=unignore&ac=" . $row['acctid'] . "' class='colLtRed'>" . translate_inline("Unignore") . "</a>]";
addnav("", "runmodule.php?module=friendlist&op=unignore&ac=" . $row['acctid']);
} else {
$info = "[<a href='runmodule.php?module=friendlist&op=ignore&ac=" . $row['acctid'] . "' class='colDkGreen'>" . translate_inline("Ignore") . "</a>]";
addnav("", "runmodule.php?module=friendlist&op=ignore&ac=" . $row['acctid']);
$info .= " - [<a href='runmodule.php?module=friendlist&op=request&ac=" . $row['acctid'] . "' class='colDkGreen'>" . translate_inline("Request") . "</a>]";
addnav("", "runmodule.php?module=friendlist&op=request&ac=" . $row['acctid']);
}
}
rawoutput("{$info}</td></tr>");
}
rawoutput("</table>");
} else {
output("`c`@`bA user was not found with that name.`b`c");
}
output_notl("`n");
}
output("`^`b`cFriend Search...`c`b");
output("`n`nWho do you want to search for?");
output("`n`nName of user: ");
rawoutput("<input name='n' maxlength='50' value=\"" . htmlentities(stripslashes(httppost('n'))) . "\">");
$apply = translate_inline("Search");
rawoutput("<input type='submit' class='button' value='{$apply}'></form>");
}
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:60,代码来源:friendlist_search.php
示例10: dod_show
function dod_show()
{
global $available_fields, $optional_fields, $tables, $smarty, $top_message, $target;
$generators = array();
$fields = $from_tbls = $query_joins = $where = $groupbys = $having = $orderbys = array();
$from_tbls[] = 'dod_generators';
$fields = array_keys($available_fields);
$where[] = 1;
$orderbys[] = 'position';
$orderbys[] = 'generator_id';
$search_query_count = cw_db_generate_query('count(generator_id)', $from_tbls, $query_joins, $where, $groupbys, $having, array(), 0);
$search_query = cw_db_generate_query($fields, $from_tbls, $query_joins, $where, $groupbys, $having, $orderbys);
$total_items_res_id = db_query($search_query_count);
$number_generators = db_num_rows($total_items_res_id);
if (empty($number_generators)) {
return null;
}
global $navigation, $page;
$navigation = cw_core_get_navigation($target, $number_generators, $page);
$limit_str = " LIMIT {$navigation['first_page']}, {$navigation['objects_per_page']}";
$generators = cw_query($search_query . $limit_str);
if (empty($generators)) {
return null;
}
$generators = array_map(create_function('$elm', '$elm["description"] = strip_tags($elm["description"]); return $elm;'), $generators);
$smarty->assign('dod_generators', cw_stripslashes($generators));
$navigation['script'] = 'index.php?target=' . $target;
$smarty->assign('navigation', $navigation);
}
示例11: shareArticle
function shareArticle()
{
$param = db_escape_string($_REQUEST['param']);
$result = db_query($this->link, "SELECT uuid, ref_id FROM ttrss_user_entries WHERE int_id = '{$param}'\n\t\t\tAND owner_uid = " . $_SESSION['uid']);
if (db_num_rows($result) == 0) {
print "Article not found.";
} else {
$uuid = db_fetch_result($result, 0, "uuid");
$ref_id = db_fetch_result($result, 0, "ref_id");
if (!$uuid) {
$uuid = db_escape_string(sha1(uniqid(rand(), true)));
db_query($this->link, "UPDATE ttrss_user_entries SET uuid = '{$uuid}' WHERE int_id = '{$param}'\n\t\t\t\t\tAND owner_uid = " . $_SESSION['uid']);
}
print __("You can share this article by the following unique URL:");
$url_path = get_self_url_prefix();
$url_path .= "/public.php?op=share&key={$uuid}";
print "<div class=\"tagCloudContainer\">";
print "<a id='pub_opml_url' href='{$url_path}' target='_blank'>{$url_path}</a>";
print "</div>";
/* if (!label_find_id($this->link, __('Shared'), $_SESSION["uid"]))
label_create($this->link, __('Shared'), $_SESSION["uid"]);
label_add_article($this->link, $ref_id, __('Shared'), $_SESSION['uid']); */
}
print "<div align='center'>";
print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('shareArticleDlg').hide()\">" . __('Close this window') . "</button>";
print "</div>";
}
示例12: search
function search($params)
{
$input = db_input(strtolower($params['input']), false);
$len = strlen($input);
$limit = isset($params['limit']) ? (int) $params['limit'] : 25;
$items = array();
$ticketid = false;
if (is_numeric($input)) {
$WHERE = ' WHERE ticketID LIKE \'' . $input . '%\'';
$ticketid = true;
} else {
$WHERE = ' WHERE email LIKE \'' . $input . '%\'';
}
$sql = 'SELECT DISTINCT ticketID,email FROM ' . TICKET_TABLE . ' ' . $WHERE . ' ORDER BY created LIMIT ' . $limit;
$resp = db_query($sql);
if ($resp && db_num_rows($resp)) {
while (list($id, $email) = db_fetch_row($resp)) {
$info = $ticketid ? $email : $id;
$id = $ticketid ? $id : $email;
$items[] = '{"id": "' . $id . '", "value": "' . $id . '", "info": "' . $info . '"}';
}
}
$result = '{"results": [' . implode(", ", $items) . ']}';
return $result;
}
示例13: shownews
function shownews($id)
{
global $list_prefix, $NEWS, $MAIN;
$sql = "SELECT * FROM " . $list_prefix . "news WHERE id = '" . $id . "';";
$result = db_query($sql);
$rows = db_num_rows($result);
if ($rows != 0) {
$row = db_fetch_array($result);
$postedby = getuser($row['posted_by']);
//lets insert the prayerrequest into our working copy of this template.
$WORK = insert_into_template($NEWS, "{NEWSTITLE}", stripslashes($row['news_title']));
$WORK = insert_into_template($WORK, "{TEASER}", stripslashes($row['teaser']));
$WORK = insert_into_template($WORK, "{NEWSID}", $row['id']);
$WORK = insert_into_template($WORK, "{POSTEDBY}", $postedby);
$WORK = insert_into_template($WORK, "{BYLINE}", $row['byline']);
$WORK = insert_into_template($WORK, "{DATE}", date("m/d/Y", $row['date']));
$WORK = insert_into_template($WORK, "{CATEGORY}", getcatname($row['category']));
$WORK = insert_into_template($WORK, "{NEWS}", stripslashes($row['news']));
$i++;
//now lets add this request to the CONTENT.
$WORK = insert_into_template($MAIN, "{CONTENT}", $WORK);
$WORK = filltemplate($WORK, striphtml($row['news_title']));
printf("%s", striptemplate($WORK));
}
}
示例14: display_wo_issue_details
function display_wo_issue_details($issue_no)
{
$result = get_work_order_issue_details($issue_no);
if (db_num_rows($result) == 0) {
display_note(_("There are no items for this issue."));
} else {
start_table(TABLESTYLE);
$th = array(_("Component"), _("Quantity"), _("Units"));
table_header($th);
$j = 1;
$k = 0;
//row colour counter
$total_cost = 0;
while ($myrow = db_fetch($result)) {
alt_table_row_color($k);
label_cell($myrow["stock_id"] . " - " . $myrow["description"]);
qty_cell($myrow["qty_issued"], false, get_qty_dec($myrow["stock_id"]));
label_cell($myrow["units"]);
end_row();
$j++;
if ($j == 12) {
$j = 1;
table_header($th);
}
//end of page full new headings if
}
//end of while
end_table();
}
}
示例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;
}