本文整理汇总了PHP中NumRows函数的典型用法代码示例。如果您正苦于以下问题:PHP NumRows函数的具体用法?PHP NumRows怎么用?PHP NumRows使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NumRows函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getWikiPage
function getWikiPage($id, $rev = 0)
{
global $canedit, $canmod;
$ptitle = $id;
if (!$ptitle) {
$ptitle = 'Main_page';
} else {
$ptitle = title2url($ptitle);
}
// so that we don't have for example 'Main page' and 'Main_page' being considered different pages
if ($rev < 0) {
$rev = 0;
}
$page = Query("SELECT p.*, pt.date, pt.user, pt.text FROM {wiki_pages} p LEFT JOIN {wiki_pages_text} pt ON pt.id=p.id AND pt.revision=" . ($rev > 0 ? 'LEAST(p.revision,{1})' : 'p.revision') . " WHERE p.id={0}", $ptitle, $rev);
if (!NumRows($page)) {
$page = array('id' => $ptitle, 'revision' => 0, 'flags' => 0, 'text' => '', 'new' => 1);
header('HTTP/1.1 404 Not Found');
header('Status: 404 Not Fount');
} else {
$page = Fetch($page);
}
$page['istalk'] = strtolower(substr($ptitle, 0, 5)) == 'talk:';
$page['ismain'] = strtolower($ptitle) == 'main_page';
$page['canedit'] = $canedit && (!($page['flags'] & WIKI_PFLAG_SPECIAL) || HasPermission('wiki.makepagesspecial'));
return $page;
}
示例2: CleanupUploads
function CleanupUploads()
{
$targetdir = DATA_DIR . 'uploads';
$timebeforedel = time() - 604800;
// one week
$todelete = Query("SELECT physicalname, user, filename FROM {uploadedfiles} WHERE deldate!=0 AND deldate<{0}", $timebeforedel);
if (NumRows($todelete)) {
while ($entry = Fetch($todelete)) {
Report("[b]{$entry['filename']}[/] deleted by auto-cleanup", false);
DeleteUpload($targetdir . '/' . $entry['physicalname'], $entry['user']);
}
Query("DELETE FROM {uploadedfiles} WHERE deldate!=0 AND deldate<{0}", $timebeforedel);
}
}
示例3: CanMod
function CanMod($userid, $fid)
{
global $loguser;
// Private messages. You cannot moderate them
if (!$fid) {
return false;
}
if ($loguser['powerlevel'] > 1) {
return true;
}
if ($loguser['powerlevel'] == 1) {
$rMods = Query("select * from {forummods} where forum={0} and user={1}", $fid, $userid);
if (NumRows($rMods)) {
return true;
}
}
return false;
}
示例4: doThreadPreview
function doThreadPreview($tid)
{
global $mobileLayout;
if ($mobileLayout) {
return;
}
$rPosts = Query("\n\t\tselect\n\t\t\t{posts}.id, {posts}.date, {posts}.num, {posts}.deleted, {posts}.options, {posts}.mood, {posts}.ip,\n\t\t\t{posts_text}.text, {posts_text}.text, {posts_text}.revision,\n\t\t\tu.(_userfields)\n\t\tfrom {posts}\n\t\tleft join {posts_text} on {posts_text}.pid = {posts}.id and {posts_text}.revision = {posts}.currentrevision\n\t\tleft join {users} u on u.id = {posts}.user\n\t\twhere thread={0} and deleted=0\n\t\torder by date desc limit 0, 20", $tid);
if (NumRows($rPosts)) {
$posts = "";
while ($post = Fetch($rPosts)) {
$cellClass = ($cellClass + 1) % 2;
$poster = getDataPrefix($post, "u_");
$nosm = $post['options'] & 2;
$nobr = $post['options'] & 4;
$posts .= Format("\n\t\t\t<tr>\n\t\t\t\t<td class=\"cell2\" style=\"width: 15%; vertical-align: top;\">\n\t\t\t\t\t{1}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"cell{0}\">\n\t\t\t\t\t<button style=\"float: right;\" onclick=\"insertQuote({2});\">" . __("Quote") . "</button>\n\t\t\t\t\t<button style=\"float: right;\" onclick=\"insertChanLink({2});\">" . __("Link") . "</button>\n\t\t\t\t\t{3}\n\t\t\t\t</td>\n\t\t\t</tr>\n\t", $cellClass, UserLink($poster), $post['id'], CleanUpPost($post['text'], $poster['name'], $nosm));
}
Write("\n\t\t<table class=\"outline margin\">\n\t\t\t<tr class=\"header0\">\n\t\t\t\t<th colspan=\"2\">" . __("Thread review") . "</th>\n\t\t\t</tr>\n\t\t\t{0}\n\t\t</table>\n\t", $posts);
}
}
示例5: listGuests
function listGuests($rGuests, $noMsg)
{
global $showIPs;
if (!NumRows($rGuests)) {
return "<tr class=\"cell0\"><td colspan=\"6\">{$noMsg}</td></tr>";
}
$i = 1;
while ($guest = Fetch($rGuests)) {
$cellClass = ($cellClass + 1) % 2;
if ($guest['date']) {
$lastUrl = "<a href=\"" . FilterURL($guest['lasturl']) . "\">" . FilterURL($guest['lasturl']) . "</a>";
} else {
$lastUrl = __("None");
}
$guestList .= "\n\t\t<tr class=\"cell{$cellClass}\">\n\t\t\t<td>{$i}</td>\n\t\t\t<td colspan=\"2\" title=\"" . htmlspecialchars($guest['useragent']) . "\">" . htmlspecialchars(substr($guest['useragent'], 0, 65)) . "</td>\n\t\t\t<td>" . cdate("d-m-y G:i:s", $guest['date']) . "</td>\n\t\t\t<td>{$lastUrl}</td>";
if ($showIPs) {
$guestList .= "<td>" . formatIP($guest['ip']) . "</td>";
}
$guestList .= "</tr>";
$i++;
}
return $guestList;
}
示例6: ForumsWithPermission
<?php
$viewableforums = ForumsWithPermission('forum.viewforum');
$tag = $_GET['tag'];
$tagcode = '"[' . $tag . ']"';
$forum = $_GET['fid'];
$cond = "WHERE MATCH (t.title) AGAINST ({0} IN BOOLEAN MODE)";
if ($forum) {
$cond .= " AND t.forum = {1}";
}
$total = Fetch(Query("SELECT count(*) from threads t {$cond} AND t.forum IN ({2c})", $tag, $forum, $viewableforums));
$total = $total[0];
$tpp = $loguser['threadsperpage'];
if (isset($_GET['from'])) {
$from = (int) $_GET['from'];
} else {
$from = 0;
}
if (!$tpp) {
$tpp = 50;
}
$rThreads = Query("\tSELECT\n\t\t\t\t\t\tt.*,\n\t\t\t\t\t\tf.(title, id),\n\t\t\t\t\t\t" . ($loguserid ? "tr.date readdate," : '') . "\n\t\t\t\t\t\tsu.(_userfields),\n\t\t\t\t\t\tlu.(_userfields)\n\t\t\t\t\tFROM\n\t\t\t\t\t\tthreads t\n\t\t\t\t\t\t" . ($loguserid ? "LEFT JOIN threadsread tr ON tr.thread=t.id AND tr.id={2}" : '') . "\n\t\t\t\t\t\tLEFT JOIN users su ON su.id=t.user\n\t\t\t\t\t\tLEFT JOIN users lu ON lu.id=t.lastposter\n\t\t\t\t\t\tLEFT JOIN forums f ON f.id=t.forum\n\t\t\t\t\t{$cond} AND f.id IN ({5c})\n\t\t\t\t\tORDER BY sticky DESC, lastpostdate DESC LIMIT {3u}, {4u}", $tagcode, $forum, $loguserid, $from, $tpp, $viewableforums);
$pagelinks = PageLinks(actionLink("tagsearch", "", "tag={$tag}&fid={$forum}&from="), $tpp, $from, $total);
if (NumRows($rThreads)) {
makeThreadListing($rThreads, $pagelinks, false, !$forum);
} else {
Alert(format(__("Tag {0} was not found in any thread."), htmlspecialchars($tag)), __("No threads found."));
}
示例7: NumRows
$re = NumRows($dbtype, $result);
$del = shell_exec("rm -rf {$getfile} 2>&1");
if ($re > 0) {
$re = FetchArray($dbtype, $result);
$smsid = $re[smsid];
$msg = stripslashes($re[msg]);
$cellnum = $re[telnum];
$pos7 = strpos($msg, " ");
if ($pos7 == "") {
$pos7 = 4;
}
$keyword = trim(strtolower(substr($msg, 0, $pos7)));
$othermsg = trim(substr($msg, $pos7 + 1, 10));
//get reply
$res = SelectDataWhere($dbtype, $dbLink, "sms_message", "where keyword='{$keyword}'");
$cnt = NumRows($dbtype, $res);
if ($cnt == 0) {
$sendthis = "Your message {$msg} is not a valid message.Please type HELP for more information";
} else {
if ($othermsg == "") {
$sendthis = FetchArray($dbtype, $res);
$sendthis = $sendthis[full_message];
$sendthis = addslashes($sendthis);
} else {
$keyword = strtolower($keyword);
$pt = substr($othermsg, 0, 1);
$pt = strtoupper($pt);
if ($pt == 'B') {
$permit_type = 'Business';
$pld = 'steps, owner_id, business_id';
$idme = 'business_permit_id';
示例8: substring
//I can't figure it out. Anybody else?
$where .= " and substring(name, 1,1) regexp '[:punct:]' or substring(displayname, 1,1) regexp '[:punct:]'";
}
if ($letter == "#") {
$where .= " and substring(name, 1,1) regexp '[0-9]' or substring(displayname, 1,1) regexp '[0-9]'";
} else {
$where .= " and name like '" . $letter . "%' or displayname like '" . $letter . "%'";
}
}
if (!(isset($pow) && $pow == 5)) {
$where .= " and powerlevel < 5";
}
$numUsers = FetchResult("select count(*) from users where " . $where, 0, 0);
$qUsers = "select * from users where " . $where . " order by " . $order . ", name asc limit " . $from . ", " . $tpp;
$rUsers = Query($qUsers);
$numonpage = NumRows($rUsers);
for ($i = $tpp; $i < $numUsers; $i += $tpp) {
if ($i == $from) {
$pagelinks .= " " . ($i / $tpp + 1);
} else {
$pagelinks .= " " . mlink($sort, $sex, $pow, $tpp, $letter, $dir, $i) . ($i / $tpp + 1) . "</a>";
}
}
if ($pagelinks) {
if ($from == 0) {
$pagelinks = "1" . $pagelinks;
} else {
$pagelinks = mlink($sort, $sex, $pow, $tpp, $letter, $dir, 0) . "1</a>" . $pagelinks;
}
}
//$alphabet .= "<li>".mlink($sort,$sex,$pow,$tpp,"@",$dir)."@</a></li>\n";
示例9: SelectDataWhere
if ($istat == 'ReNew') {
// || $istat=='Retire') {
require "includes/penalty.php";
}
} else {
echo "0.00";
$amt2pay[$si + 1] = 0;
}
?>
</td>
<?php
//check if no more line to pay
$hvl = SelectDataWhere($dbtype, $dbLink, "tempbusnature", "where owner_id = {$owner_id} and\n\t\t\tbusiness_id={$business_id} and linepaid=0");
$hvl = NumRows($dbtype, $hvl);
//getpayhistory
if ($balance == '') {
$balance = $tabs;
}
if ($balance >= 0) {
//echo $cnthave."-".$gethis."<BR>";
if ($iswev == 1) {
//$gethis=1;
}
if ($gethis == 0 and $hvl > 0 and $amt2pay[$si + 1] > 0) {
if ($mayunpaid == 1) {
$unpaid = 2;
} else {
$mayunpaid = 1;
$unpaid = 1;
示例10: SelectDataWhere
$getna = $getnat['naturedesc'];
$nat = SelectDataWhere($dbtype, $dbLink, "tempbusnature", "where tempid='{$savenat}'");
$getnat = FetchArray($dbtype, $nat);
$transme = $getnat['transaction'];
if ($transme == 'New') {
$multi = $_cap;
$oldm = $getnat[cap_inv];
} else {
$multi = $lastyr;
$oldm = $getnat[last_yr];
}
$result = UpdateQuery($dbtype, $dbLink, "tempbusnature", "bus_code={$_idx}, bus_nature='{$getna}', cap_inv='{$_cap}',\n last_yr='{$lastyr}'", "tempid='{$savenat}'");
$result = UpdateQuery($dbtype, $dbLink, "tempassess", "multi='{$multi}'", "owner_id='{$owner_id}' and\n\t\t\t\t\t business_id='{$business_id}' and natureid = '{$business_nature_code}'\n\t\t\t\t\t and transaction = '{$stat}' and multi='{$oldm}'");
} else {
$check = SelectDataWhere($dbtype, $dbLink, $tempbiz, "where bus_code='{$_idx}' and business_id={$business_id}\n and owner_id={$owner_id}");
$checkit = NumRows($dbtype, $check);
if ($checkit == 0) {
//get nature_desc
$nat = SelectDataWhere($dbtype, $dbLink, "ebpls_buss_nature", "where natureid='{$_idx}'");
$getnat = FetchArray($dbtype, $nat);
$getnat = $getnat['naturedesc'];
//save to temp table
if ($stat == 'New') {
if ($business_capital_investment != 0) {
$oki = 1;
} else {
$oki = 0;
}
} else {
if ($gross_sale != 0 || $business_capital_investment != 0) {
$oki = 1;
示例11: mysql_query
if ($ry == '1') {
$getpyr = mysql_query("select * from {$permittable} order by {$incode} desc");
$gt = mysql_fetch_assoc($getpyr);
$anoba = $gt["for_year"];
if ($anoba == date('Y')) {
//get total number of permit released
$curyr = date('Y');
$gettotal = SelectDataWhere($dbtype, $dbLink, $permittable, "where released = 1 and for_year = '{$curyr}'");
$gettot = NumRows($dbtype, $gettotal);
} else {
$gettot = 0;
}
} else {
//get total number of permit released
$gettotal = SelectDataWhere($dbtype, $dbLink, $permittable, "where released = 1");
$gettot = NumRows($dbtype, $gettotal);
}
$sequence = $getcode[2];
$sequence = '100000000000' + $sequence;
$sequence = $sequence + $gettot + 1;
$sequence = substr($sequence, 1, 11);
if ($getcode[1] == '1') {
// check if have date
$permitnumber = $getcode[0] . "-" . $currdate[year] . "-" . $sequence;
} else {
$permitnumber = $getcode[0] . "-" . $sequence;
}
if ($permit_type != 'Business') {
//insert permitcode to $permittable
$updateit = UpdateQuery($dbtype, $dbLink, $permittable, "{$incode}='{$permitnumber}'", "owner_id={$owner_id}");
//update it to released status
示例12: Query
$ppp = $loguser['postsperpage'];
if (!$ppp) {
$ppp = 20;
}
if (isset($_GET['from'])) {
$from = $_GET['from'];
} else {
$from = 0;
}
$rPosts = Query("\n\t\t\tSELECT\n\t\t\t\tp.*,\n\t\t\t\tpt.text, pt.revision, pt.user AS revuser, pt.date AS revdate,\n\t\t\t\tu.(_userfields), u.(rankset,title,picture,posts,postheader,signature,signsep,lastposttime,lastactivity,regdate,globalblock),\n\t\t\t\tru.(_userfields),\n\t\t\t\tdu.(_userfields)\n\t\t\tFROM\n\t\t\t\t{posts} p\n\t\t\t\tLEFT JOIN {posts_text} pt ON pt.pid = p.id AND pt.revision = p.currentrevision\n\t\t\t\tLEFT JOIN {users} u ON u.id = p.user\n\t\t\t\tLEFT JOIN {users} ru ON ru.id=pt.user\n\t\t\t\tLEFT JOIN {users} du ON du.id=p.deletedby\n\t\t\tWHERE thread={1}\n\t\t\tORDER BY date ASC LIMIT {2u}, {3u}", $loguserid, $tid, $from, $ppp);
$numonpage = NumRows($rPosts);
$pagelinks = PageLinks(actionLink("thread", $tid, "from="), $ppp, $from, $total);
if ($pagelinks) {
write("<div class=\"smallFonts pages\">" . __("Pages:") . " {0}</div>", $pagelinks);
}
if (NumRows($rPosts)) {
while ($post = Fetch($rPosts)) {
$post['closed'] = $thread['closed'];
MakePost($post, POST_NORMAL, array('tid' => $tid, 'fid' => $fid));
}
}
if ($pagelinks) {
write("<div class=\"smallFonts pages\">" . __("Pages:") . " {0}</div>", $pagelinks);
}
if ($loguserid && $loguser['powerlevel'] >= $forum['minpowerreply'] && (!$thread['closed'] || $loguser['powerlevel'] > 0) && !isset($replyWarning)) {
$ninja = FetchResult("select id from {posts} where thread={0} order by date desc limit 0, 1", $tid);
//Quick reply goes here
if (CanMod($loguserid, $fid)) {
//print $thread['closed'];
if (!$thread['closed']) {
$mod .= "<label><input type=\"checkbox\" name=\"lock\"> " . __("Close thread", 1) . "</label>\n";
示例13: SelectDataWhere
</tr>
<?php
//if ($owner_id<>'' and $business_id<>'') {
$ic = 0;
$col1 = 0;
$getreq = SelectDataWhere($dbtype, $dbLink, "ebpls_buss_requirements", "where recstatus='A' and reqindicator='1' and permit_type='Business'");
$gt = NumRows($dbtype, $getreq);
while ($ic < $gt) {
while ($getr = FetchRow($dbtype, $getreq)) {
$ic++;
if ($col1 == 0) {
include 'tablecolor-inc.php';
print "<tr bgcolor='{$varcolor}'>\n";
}
$check1 = SelectDataWhere($dbtype, $dbLink, "havereq", " where owner_id={$owner_id}\n \tand business_id={$business_id} \n\t\t\t\t\tand reqid={$getr['0']}");
$hreq = NumRows($dbtype, $check1);
if ($hreq == 0) {
$insertreq = InsertQuery($dbtype, $dbLink, "havereq", "", "'', {$getr['0']}, {$owner_id}, {$business_id},0");
$ch = 'UNCHECKED';
$gethr[4] = 0;
} else {
$gethr = FetchRow($dbtype, $check1);
if ($gethr[4] == 1) {
$ch = 'CHECKED';
} else {
$ch = 'UNCHECKED';
}
}
$getr[1] = stripslashes($getr[1]);
print "\t\n\t\t\t\t<td align=right width=5%><input type=hidden name=colre[{$ic}] \n\t\t\t\tvalue={$getr['0']}>  \n\t\t\t\t<input type=checkbox name=x[{$ic}] {$ch}></td><td align=left width=23%>{$getr['1']}\n\t\t\t\t</td>";
$col1 = $col1 + 1;
示例14: WriteCategoryEditContents
function WriteCategoryEditContents($cid)
{
global $loguser, $forumBoards;
$boardlist = '';
if ($cid != -1) {
$rCategory = Query("SELECT * FROM {categories} WHERE id={0}", $cid);
if (!NumRows($rCategory)) {
Kill("Category not found.");
}
$cat = Fetch($rCategory);
$candelete = FetchResult("SELECT COUNT(*) FROM {forums} WHERE catid={0}", $cid) == 0;
$name = htmlspecialchars($cat['name']);
$corder = $cat['corder'];
if (count($forumBoards) > 1) {
foreach ($forumBoards as $bid => $bname) {
$boardlist .= '<label><input type="radio" name="board" value="' . htmlspecialchars($bid) . '"' . ($cat['board'] == $bid ? ' checked="checked"' : '') . '> ' . htmlspecialchars($bname) . '</label>';
}
}
$boxtitle = __("Editing category ") . $name;
$fields = array('name' => '<input type="text" name="name" value="' . $name . '" size=64>', 'order' => '<input type="text" name="corder" value="' . $corder . '" size=3>', 'board' => $boardlist, 'btnSave' => '<button onclick="changeCategoryInfo(' . $cid . '); return false;">Save</button>', 'btnDelete' => '<button ' . ($candelete ? 'onclick="deleteCategory(); return false;"' : 'disabled="disabled"') . '>Delete</button>');
$delMessage = $candelete ? '' : __('Before deleting a category, remove all forums from it.');
} else {
if (count($forumBoards) > 1) {
foreach ($forumBoards as $bid => $bname) {
$boardlist .= '<label><input type="radio" name="board" value="' . htmlspecialchars($bid) . '"' . ($bid == '' ? ' checked="checked"' : '') . '> ' . htmlspecialchars($bname) . '</label>';
}
}
$boxtitle = __("New category");
$fields = array('name' => '<input type="text" name="name" value="" size=64>', 'order' => '<input type="text" name="corder" value="0" size=3>', 'board' => $boardlist, 'btnSave' => '<button onclick="addCategory(); return false;">Save</button>', 'btnDelete' => '');
$delMessage = '';
}
echo "\n\t<form method=\"post\" id=\"forumform\" action=\"" . htmlentities(actionLink("editfora")) . "\">\n\t<input type=\"hidden\" name=\"key\" value=\"" . $loguser["token"] . "\">\n\t<input type=\"hidden\" name=\"id\" value=\"{$cid}\">";
RenderTemplate('form_editcategory', array('formtitle' => $boxtitle, 'fields' => $fields, 'delMessage' => $delMessage));
echo "\n\t</form>";
}
示例15: SelectMultiTable
$getfee = SelectMultiTable($dbtype, $dbLink, "boat_fee", "amt", "where boat_type='{$getb['4']}' and\n range_lower<={$getb['5']} and range_higher=0 and\n transaction='{$stat}' and active = 1");
}
$getfee = FetchRow($dbtype, $getfee);
$ttfee = $ttfee + $getfee[0];
}
$getot = SelectDataWhere($dbtype, $dbLink, $fee, " where permit_type='{$stat}' and active=1");
$getact = SelectMultiTable($dbtype, $dbLink, "fish_activity", "sum(act_fee)", "where owner_id={$owner_id} and transaction='{$stat}' and active = 1");
$getact = FetchRow($dbtype, $getact);
$tfee1 = $getact[0];
$getboat = SelectDataWhere($dbtype, $dbLink, "fish_assess", "where owner_id={$owner_id}");
while ($getb = FetchArray($dbtype, $getboat)) {
$getfee = SelectDataWhere($dbtype, $dbLink, "culture_fee", "where culture_id='{$getb['culture_id']}' and\n\t\t transaction='{$stat}' and active = 1 ");
$getnum = FetchArray($dbtype, $getfee);
if ($getnum[fee_type] == '3') {
$getfee = SelectDataWhere($dbtype, $dbLink, "culture_range", "where culture_id='{$getb['culture_id']}' and\n\t\t range_lower<{$getb['amt']} and range_higher>={$getb['amt']} ");
$getnum = NumRows($dbtype, $getfee);
if ($getnum == 0) {
$getfee = SelectDataWhere($dbtype, $dbLink, "culture_range", "where culture_id='{$getb['culture_id']}' and\n range_lower<={$getb['amt']} and range_higher=0");
}
}
$getfee1 = FetchArray($dbtype, $getfee);
$ttfee1 = $ttfee1 + $getfee1[amt];
}
?>
<table width=60%>
<tr>
<td>Fees from Boat Registration</td><td><?php
echo number_format($ttfee, 2);
?>
</td>
</tr>