本文整理汇总了PHP中db_num函数的典型用法代码示例。如果您正苦于以下问题:PHP db_num函数的具体用法?PHP db_num怎么用?PHP db_num使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了db_num函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getMembers
/**
* Provides all members of this group.
*
* @return UserGroupMember[]
*/
public function getMembers()
{
// First get all userIDs that are members.
$qAllMembers = db_query(sprintf("SELECT `userID`,`access` FROM `%s_group_members` WHERE `groupID`=%d", db_prefix(), $this->getGroupID()));
$nAllMembers = db_num($qAllMembers);
// Verify that we got any users.
if ($qAllMembers === false || $nAllMembers < 1) {
return array();
}
$members = array();
$userIDs = array();
$rowsIndexedByUID = array();
// Fetch each as User
while ($row = db_fetch_assoc($qAllMembers)) {
$userIDs[] = $row["userID"];
$rowsIndexedByUID[$row["userID"]] = $row;
}
// Fetch the users.
$users = UserManager::getInstance()->getUsersByID($userIDs);
if (count($users) < 1) {
return array();
}
// Create as UserGroupMember
foreach ($users as $user) {
$memberRow = $rowsIndexedByUID[$user->getUserID()];
$member = new UserGroupMember($user->getUserID());
$member->fillInfo($user->getInfo());
// fill extra variables
$member->setAccess($memberRow["access"]);
$member->setGroup($this);
$members[] = $member;
unset($memberRow, $user, $member);
}
return $members;
}
示例2: print_comments_table
function print_comments_table($fileid){
global $phrases,$member_data,$id,$content,$op_comment,$sec_img,$sec_string,$settings,$admin_path;
if($settings['files_comments_enable']){
//-------- send comment command ---------
if($op_comment=="send_comment"){
if(check_member_login()){
if($sec_img->verify_string($sec_string)){
$content = htmlspecialchars($content);
$memberid = $member_data['id'] ;
db_query("insert into mobile_files_comments (memberid,content,fileid,date) values('$memberid','$content','$id',now())");
open_table();
print "<center>$phrases[your_comment_sent_successfully]</center>";
close_table();
$content="";
}else{
open_table();
print "<center>$phrases[err_sec_code_not_valid]</center>";
close_table();
}
}else{
open_table();
print "<center> $phrases[please_login_first] </center>";
close_table();
}
}
$qr = db_query("select * from mobile_files_comments where fileid='$fileid'");
if(db_num($qr)){
open_table("$phrases[the_comments]");
print "<hr size=1 class=separate_line>";
while($data = db_fetch($qr)){
$dx = db_qr_fetch("select ".members_fields_replace('username').",".members_fields_replace('email')." from ".members_table_replace('mobile_members')." where ".members_fields_replace('id')."='$data[memberid]'",MEMBER_SQL);
print "<table width=100% border=0><tr><td width=50%><b>$dx[username]</b></td><td align=left>$data[date]</td></tr>";
print "<tr><td colspan=2>$data[content] <a href=\"javascript:report($id,$data[id]);\"><font color='red'>ΚΘανΫ</font></a>";
if(check_login_cookies()){
print " [<a href='".iif($admin_path,$admin_path,"admin")."/index.php?action=comment_del&id=$data[id]&cat=$id'>$phrases[delete]</a>]";
}
print "<br><hr size=1 class=separate_line></td></tr></table>";
}
close_table();
}
}
}
示例3: getProductByID
/**
* @param $productID
* @return LanProduct|null
*/
public function getProductByID($productID)
{
if (!is_numeric($productID) || $productID < 1) {
return null;
}
$query = db_query(sprintf("SELECT `ID`,`wareType`,`name`,`price` FROM `%s_kiosk_wares` WHERE `ID` = %d LIMIT 0,1", db_prefix(), $productID));
if (db_num($query) < 1) {
return null;
}
$result = db_fetch_assoc($query);
$product = new LanProduct($productID);
$product->fillInfo($result);
return $product;
}
示例4: getArticle
/**
* Provides a single article instance.
*
* @param int $articleID
* @return NewsArticle|null
*/
public function getArticle($articleID)
{
global $sql_prefix, $sessioninfo;
if (intval($articleID) < 1) {
return null;
}
$query = sprintf("SELECT ID,header,eventID,content,createTime,active,global FROM %s_news WHERE ID=%s AND ((global='yes' OR eventID=1) OR eventID=%s)", $sql_prefix, $articleID, $sessioninfo->eventID);
$result = db_query($query);
if ($result == false || db_num($result) < 1) {
return null;
}
$row = db_fetch_assoc($result);
$articleObject = new NewsArticle($articleID);
$articleObject->fillInfo($row);
unset($row, $result);
return $articleObject;
}
示例5: getTicketTypes
/**
* Provides the ticket types
*
* @param int $eventID If null then active event is used.
* @return TicketType
*/
public function getTicketTypes($eventID = null)
{
global $sessioninfo, $sql_prefix;
if ($eventID == null) {
$eventID = $sessioninfo->eventID;
}
$result = db_query(sprintf("SELECT * FROM `%s_ticketTypes` WHERE `eventID` = %d", $sql_prefix, $eventID));
$num = db_num($result);
$ticketTypes = array();
if ($num > 0) {
$i = 0;
while ($row = db_fetch_assoc($result)) {
$ticketTypes[$i] = new TicketType($row['ticketTypeID']);
$ticketTypes[$i]->fillInfo($row);
$i++;
}
}
return $ticketTypes;
}
示例6: getApplicationComments
/**
* @param int $userID
* @param array $crewIDs
* @return AdminComment[]
*/
public function getApplicationComments($userID, $crewIDs)
{
global $sessioninfo;
$query = "SELECT `ID`,`crewID`,`comment`,`approval`,`userID`,`adminID`,`createdTime`,`commentType` FROM `" . db_prefix() . "_wannabeComment`";
$query .= " WHERE `userID`=" . $userID . "";
$query .= " AND `crewID` IN(" . implode(",", $crewIDs) . ")";
$qComments = db_query($query);
if (db_num($qComments) < 1) {
return array();
}
$comments = array();
while ($row = db_fetch_assoc($qComments)) {
$commentObject = new AdminComment($row["ID"]);
$commentObject->fillInfo($row);
$comments[] = $commentObject;
unset($commentObject, $row);
}
unset($qComments, $query);
return $comments;
}
示例7: db_fetch_all
/**
* returns all results as array
*
* @param $query
* @return array
*/
function db_fetch_all($query)
{
global $sql_type;
/* Function to fetch results from db_query */
$return = array();
switch ($sql_type) {
case "mysql":
case "mysqli":
if (db_num($query) > 0) {
while ($row = db_fetch($query)) {
$return[] = $row;
}
}
break;
default:
die("Something seriously wrong with variable sql_type in function " . __FUNCTION__);
}
// End switch ($sql_type)
return $return;
}
示例8: elseif
$seatcontent .= ">{$value}</option>\n";
}
// End foreach globalaccess
$seatcontent .= "</select>\n";
} elseif ($type == "r" && isset($_POST['right'])) {
$action = "doUpdateSeat";
}
// End type == r and isset(right)
}
// End if action == "updateSeat"
if (!isset($action) || $action == "updateSeat") {
// No action set... Display the map
// First, get amount of rows
$qGetSeatY = db_query("SELECT DISTINCT seatY FROM " . $sql_prefix . "_seatReg\n\t\tWHERE eventID = '" . $sessioninfo->eventID . "'\n\t\tORDER BY seatY ASC");
$content .= "<form method=\"post\" action=\"?module=seatadmin&action=updateSeat\">\n";
if (db_num($qGetSeatY) != 0) {
$content .= "<table style=\"border: 1px solid;\">\n";
while ($rGetSeatY = db_fetch($qGetSeatY)) {
$seatY = $rGetSeatY->seatY;
// Start a new row
$content .= "<tr>\n";
// Get the contents of the row; the columns
$qGetSeatX = db_query("SELECT * FROM " . $sql_prefix . "_seatReg\n\t\t\t\tWHERE eventID = '" . $sessioninfo->eventID . "'\n\t\t\t\tAND seatY = '" . $rGetSeatY->seatY . "'\n\t\t\t\tORDER BY seatX ASC");
while ($rGetSeatX = db_fetch($qGetSeatX)) {
$seatX = $rGetSeatX->seatX;
$content .= "<td style='height: 25px; width: 25px; background-color: " . $rGetSeatX->color;
$content .= "'>\n";
$content .= "<input type=\"checkbox\" value=\"1\" name=\"x" . $seatX . "y" . $seatY . "\"";
if ($_POST['x' . $seatX . 'y' . $seatY] == 1) {
$content .= " CHECKED";
}
示例9: array
$result = array();
$resultCount = 0;
// Verify there is a search query
$searchString = db_escape($_POST['query']);
if (strlen($_POST['query']) > 0 || $scope == "tickets") {
$query = null;
$str = db_escape(htmlspecialchars($_POST['query']));
if ($scope == 'all') {
$query = sprintf("SELECT nick, firstName, lastName as lastName, ID FROM %s WHERE\n (nick LIKE '%%%s%%' OR\n firstName LIKE '%%%s%%' OR\n lastName LIKE '%%%s%%' OR\n CONCAT(firstName, ' ', lastName) LIKE '%%%s%%' OR\n EMail LIKE '%%%s%%'\n ) ORDER BY ID", $usertable, $str, $str, $str, $str, $str);
} else {
if ($scope == "tickets") {
$query = sprintf("SELECT DISTINCT u.nick as nick, u.firstName as firstName, u.lastName as lastName,\n u.ID as ID FROM %s as u, %s as t WHERE t.eventID=%s AND t.user=u.ID AND\n (u.nick LIKE '%%%s%%' OR\n u.firstName LIKE '%%%s%%' OR\n u.lastName LIKE '%%%s%%' OR\n CONCAT(u.firstName, ' ', u.lastName) LIKE '%%%s%%' OR\n EMail LIKE '%%%s%%'\n ) ORDER BY u.ID", $usertable, $ticketstable, $sessioninfo->eventID, $str, $str, $str, $str, $str);
}
}
$result = db_query($query);
$num = db_num($result);
$content .= "<table class=\"table ticket-table\"><thead><tr><th>" . _("Name") . "</th><th>" . _("Tickets") . "</th></tr></thead><tbody>";
if ($num > 0) {
$i = 0;
while ($row = db_fetch($result)) {
$cssClass = $i++ % 2 == 0 ? 'odd' : 'even';
$tickets = $ticketManager->getTicketsOfUser($row->ID, null, array(''));
$content .= "<tr class=\"{$cssClass}\"><td>" . $row->firstName . " " . $row->lastName . " (" . $row->nick . ")</td><td>";
// Output tickets
if (count($tickets) > 0) {
$content .= "<div class=\"tickets-list\">";
foreach ($tickets as $value) {
$extraCss = "";
if ($value->getStatus() == Ticket::TICKET_STATUS_DELETED) {
$extraCss = " deleted";
} else {
示例10: if_admin
}
//---------------------- Events types add ----------------------
if($action=="events_types_add"){
if_admin("events");
print "<center>
<form action='index.php' method=post>
<input name=action value='events_types_add_ok' type=hidden>
<table width=50% class=grid>
<tr><td> $phrases[the_name] </td><td><input type=text size=20 name=name></td></tr>
<tr><td> $phrases[the_color] </td><td><input type=text size=20 name=color dir=ltr></td></tr>
<tr><td colspan=2 align=center><input type=submit value=' $phrases[add_button] '></td></tr>
</table></form></center>";
}
//---------------------- Events types edit ----------------------
if($action=="events_types_edit"){
if_admin("events");
$id = intval($id);
$qr = db_query("select * from events_types where id='$id'");
if(db_num($qr)){
$data = db_fetch($qr);
print "<center>
<form action='index.php' method=post>
示例11: log_add
$log_old[$prefname] = $rFindPref->value;
$log_new[$prefname] = $POST;
}
}
// End for
log_add("edituser", "doEditPreferences", serialize($log_new), serialize($log_old));
header("Location: ?module=edituserinfo&action=editPreferences&user={$userID}&change=success");
} elseif ($action == "profilePicture" && isset($_GET['user'])) {
$user = $_GET['user'];
$userAdmin_acl = acl_access("userAdmin", "", 1);
if ($user == $sessioninfo->userID) {
} elseif ($userAdmin_acl == 'Admin' || $userAdmin_acl == 'Write') {
} else {
die(lang("Not access to edit profile picture", "edituserinfo"));
}
$qFindProfile = db_query("SELECT * FROM " . $sql_prefix . "_files WHERE extra = '" . db_escape($user) . "' AND file_type = 'profilepic'");
if (db_num($qFindProfile) > 0) {
$rFindProfile = db_fetch($qFindProfile);
$content .= "<img src='{$rFindProfile->file_path}'>";
}
$content .= '<form enctype="multipart/form-data" action="upload.php" method="POST">';
$content .= '<input type="hidden" name="file_type" value="profilepic" />';
$content .= _("Choose file to upload: ");
$content .= "<input name=uploadfile type=file />";
$content .= "<input type=submit value='" . _("Upload picture") . "' />";
$content .= "</form>";
} else {
// no action defined? ship user back to start.
header('Location: index.php');
die;
}
示例12: addTicketType
/**
* Adds a tickettype to this user i.e. creates a ticket in the _tickets table.
*
* <p>See validateAddTicketType to handle max amount of tickets an user can order, ment for "ticketorder" module.</p>
*
* @see validateAddTicketType()
* @param TicketType $ticketType The ticket type to add.
* @param int $amount Amount to add.
* @param User|null $creator If an moderator has added this ticket, send the mods User object.
* @return array Array of the new tickets md5 ID.
*/
public function addTicketType(TicketType $ticketType, $amount = 1, $creator = null)
{
global $sessioninfo, $sql_prefix, $maxTicketsPrUser;
if ($creator instanceof User == false) {
$creator = $this;
}
$insertIDs = array();
for ($i = 0; $i < $amount; $i++) {
db_query(sprintf("INSERT INTO %s_tickets(`md5_ID`, `ticketType`, `eventID`, `owner`, `createTime`, `creator`, `user`)\n VALUES('%s', %d, %d, %d, %d, %d, %d)", $sql_prefix, md5(rand() . time() . $this->getUserID()), $ticketType->getTicketTypeID(), $sessioninfo->eventID, $this->getUserID(), time(), $creator->getUserID(), $this->getUserID()));
// Find md5 ID from ticket ID
$qTicketMd5ID = db_query(sprintf("SELECT `md5_ID` FROM %s_tickets WHERE `ticketID`=%s", $sql_prefix, db_insert_id()));
if (db_num($qTicketMd5ID) < 0) {
continue;
}
$rows = db_fetch_assoc($qTicketMd5ID);
$insertIDs[] = $rows["md5_ID"];
}
return $insertIDs;
}
示例13: header
} else {
header("Location: ?module=eventadmin&action=groupRights&groupID={$groupID}");
}
} elseif ($action == "eventaccess") {
// if event is private, admin who can attend
// FIXME: Only works for accessgroups for now...
// Should be possible for specially invited people in clans, and all accessgroups
$qListGroups = db_query("SELECT * FROM " . $sql_prefix . "_groups WHERE groupType = 'access' AND ID != 1 ORDER BY eventID DESC");
$row = 1;
$content .= "<table>";
while ($rListGroups = db_fetch($qListGroups)) {
$content .= "<tr class='listRow{$row}'><td>";
$content .= $rListGroups->groupname;
$content .= "</td><td>";
$qCheckAccess = db_query("SELECT * FROM " . $sql_prefix . "_ACLs \n\t\t\tWHERE access != 'No' \n\t\t\tAND accessmodule = 'eventAttendee' \n\t\t\tAND eventID = '{$sessioninfo->eventID}' \n\t\t\tAND groupID = '{$rListGroups->ID}'");
if (db_num($qCheckAccess) == 0) {
$content .= "<a href=?module=eventadmin&action=doChangeRights&groupID={$rListGroups->ID}&accessmodule=eventAttendee&groupRight=Read>";
$content .= "<img src=images/icons/no.png width=\"50%\"></a>";
// $content .= lang("Allow attendee", "eventadmin")."</a>";
} else {
$content .= "<a href=?module=eventadmin&action=doChangeRights&groupID={$rListGroups->ID}&accessmodule=eventAttendee&groupRight=No>";
$content .= "<img src=images/icons/yes.png width=\"50%\"></a>";
// $content .= lang("Disallow attendee", "eventadmin")."</a>";
}
$row++;
if ($row == 3) {
$row = 1;
}
}
// End while
$content .= "</table>";
示例14: db_query
print "<table width=98% style=\"padding: 0\"><tr><td>";
$qr = db_query("select * from songs_dedications where active=1 order by id desc limit 20");
if(db_num($qr)){
print " <marquee align=\"right\" direction=\"right\" scrollamount=\"4\" style=\"font-family: Tahoma; font-size: 12px; COLOR: #000000; LINE-HEIGHT: 30px; text-decoration: none dir: rtl; text-align: right;\" onmouseover=\"this.scrollAmount=0\" onmouseout=\"this.scrollAmount='5'\"> \n";
print " *Ü* ";
while($data = db_fetch($qr)){
$data['msg'] = addslashes($data['msg']);
$emo_qr = db_query("select * from songs_emotions");
while($emo_data = db_fetch($emo_qr)){
$data['msg'] = str_replace($emo_data['value'],"<img src=\"$emo_data[img]\">",$data['msg']);
}
$qr_user = db_query("select id from mobile_members where username like '$data[user]'");
if(db_num($qr_user)){
$data_user = db_fetch($qr_user);
print "<b><a href='index.php?action=profile&id=$data_user[id]' target=_blank>$data[user]</a>:</b>";
}else{
print "<b>$data[user]:</b>";
}
print " $data[msg] *Ü* " ;
}
print "</marquee>";
}else{
print "<center> áÇ ÊæÌÏ ÅåÏÇÆÇÊ </center>";
}
print "</td><td width=10%>
<a href='#' onclick=\"window.open('send_dedication.php','displaywindow','toolbar=no,scrollbars=no,width=350,height=380,top=200,left=200');return false;\"> ÇÑÓá ÅåÏÇÁ </a>
<br>
<a href=\"javascript:get_dedications();\">ÊÍÏíË</a>
示例15: die
} else {
die(_("User not found!"));
}
} else {
// Assume we've used AJAX search, and that $ware is an ID
$qFindWareID = db_query("SELECT * FROM " . $sql_prefix . "_kiosk_wares WHERE ID = '" . db_escape($ware) . "'");
if (db_num($qFindWareID) == 1) {
$rFindWareID = db_fetch($qFindWareID);
$wareID = $rFindWareID->ID;
}
// End if db_num == 1
}
// End else
if (!$checkingUser) {
$qFindBasket = db_query("SELECT * FROM " . $sql_prefix . "_kiosk_shopbasket \n\t\t\tWHERE sID = '{$sessioninfo->sID}'\n\t\t\tAND wareID = '{$wareID}'");
if (db_num($qFindBasket) == 0) {
db_query("INSERT INTO " . $sql_prefix . "_kiosk_shopbasket\n\t\t\t\tSET sID = '{$sessioninfo->sID}',\n\t\t\t\twareID = {$wareID}");
} else {
db_query("UPDATE " . $sql_prefix . "_kiosk_shopbasket\n\t\t\t\tSET amount = amount + 1\n\t\t\t\tWHERE sID = '{$sessioninfo->sID}'\n\t\t\t\tAND wareID = {$wareID}");
}
// End else
}
// End if checkingUser == FALSE
header("Location: ?module=kiosk");
} elseif ($action == "removeWare") {
$ware = $_REQUEST['ware'];
$qFindAmount = db_query("SELECT * FROM " . $sql_prefix . "_kiosk_shopbasket WHERE \n\t\tsID = '{$sessioninfo->sID}'\n\t\tAND wareID = '" . db_escape($ware) . "'\n\t\t");
$rFindAmount = db_fetch($qFindAmount);
if ($rFindAmount->amount == 1) {
db_query("DELETE FROM " . $sql_prefix . "_kiosk_shopbasket WHERE sID = '{$sessioninfo->sID}' AND wareID = '" . db_escape($ware) . "'");
} else {