本文整理匯總了PHP中MYSQL_NUMROWS函數的典型用法代碼示例。如果您正苦於以下問題:PHP MYSQL_NUMROWS函數的具體用法?PHP MYSQL_NUMROWS怎麽用?PHP MYSQL_NUMROWS使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了MYSQL_NUMROWS函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: sendNewsletter
function sendNewsletter($from, $newsTitle, $newsBody)
{
$sql = "SELECT * FROM mailing_list WHERE active='1'";
$result = MYSQL_QUERY($sql);
$numberOfRows = MYSQL_NUMROWS($result);
$i = 0;
while ($i < $numberOfRows) {
$thisEmail = MYSQL_RESULT($result, $i, "email");
$thisUid = MYSQL_RESULT($result, $i, "uid");
$thisName = MYSQL_RESULT($result, $i, "full_name");
/* recipients */
$to = $thisEmail;
// note the comma
/* subject */
$subject = $newsTitle;
/* message */
$message = "Dear {$thisName} <br>";
$message .= $newsBody . '<br><br><a href="' . _PREF . 'modules/mailing_ilst/deleteMailing_list.php?thisEmailField=' . $thisEmail . '&thisUidField=' . $thisUid . '">
To unsubscribe please click here</a>';
/* To send HTML mail, you can set the Content-type header. */
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
/* additional headers */
$headers .= "To:" . $thisEmail . "\r\n";
$headers .= "From: " . $from;
/* and now mail it */
$s = mail($to, $subject, $message, $headers);
$i++;
}
if ($s) {
echo '<script>correctMessage("Message Sent successfuly");</script>';
} else {
echo '<script>errorMessage("Sorry message has not been sent, an error has occurred");</script>';
}
}
示例2: MYSQL_QUERY
<?php
include_once "../common/dbConnection.php";
include_once "../common/header.php";
$thisCHARACTER_SET_NAME = $_REQUEST['CHARACTER_SET_NAMEField'];
$sql = "SELECT * FROM CHARACTER_SETS WHERE CHARACTER_SET_NAME = '{$thisCHARACTER_SET_NAME}'";
$result = MYSQL_QUERY($sql);
$numberOfRows = MYSQL_NUMROWS($result);
if ($numberOfRows == 0) {
?>
Sorry. No records found !!
<?php
} else {
if ($numberOfRows > 0) {
$i = 0;
$thisCHARACTER_SET_NAME = MYSQL_RESULT($result, $i, "CHARACTER_SET_NAME");
$thisDEFAULT_COLLATE_NAME = MYSQL_RESULT($result, $i, "DEFAULT_COLLATE_NAME");
$thisDESCRIPTION = MYSQL_RESULT($result, $i, "DESCRIPTION");
$thisMAXLEN = MYSQL_RESULT($result, $i, "MAXLEN");
}
}
?>
View Record<br><br>
<table>
<tr height="30">
<td align="right"><b>CHARACTER_SET_NAME : </b></td>
<td><?php
示例3: updateAfterDelete
function updateAfterDelete($table, $newId)
{
$test = 1;
echo $newId;
$s = "select * from {$table} ";
$r = mysql_query($s);
$numberOfRows = MYSQL_NUMROWS($r);
$iz = 0;
$newId = explode(',', $newId);
while ($iz < $numberOfRows) {
$id = MYSQL_RESULT($r, $iz, "id");
$arr = MYSQL_RESULT($r, $iz, "collage_id");
$selected_ids = explode(',', $arr);
$n = "";
foreach ($selected_ids as $c) {
if (!in_array($c, $newId) || $c === '0') {
$n .= $c . ",";
} else {
$test = 0;
}
}
if ($test == 0) {
$n = str_replace(',,', ',', $n);
$wq = 'UPDATE ' . $table . ' SET `collage_id`="' . $n . '" WHERE id=' . $id;
mysql_query($wq);
}
$n = "";
$test = 1;
$iz++;
}
}
示例4: mysql_query
<thead>
<tr>
<td width="697" align="left" bgcolor="#cccccc"><strong>Comment</strong></td>
<td width="64" align="center" bgcolor="#cccccc">Post</td>
<td width="85" align="center" bgcolor="#cccccc">Delete</td>
</tr>
</thead>
<?php
include "include/dbconnection.php";
// sending query
$result = mysql_query("SELECT * FROM comment WHERE status='unpost' ORDER BY date");
if (!$result) {
die("Query to show fields from table failed");
}
$rows = MYSQL_NUMROWS($result);
if ($rows == 0) {
echo '<div style=" color:red; text-align:center;"><h5>No Comments Found!</h5></div>';
} else {
if ($rows > 0) {
$i = 0;
while ($i < $rows) {
if ($i % 2 == 0) {
$bgcolor = '#FFFFFF';
} else {
$bgcolor = '@C0C0C0';
}
$comment = MYSQL_RESULT($result, $i, "comment");
$comment_id = MYSQL_RESULT($result, $i, "comment_id");
?>
<tr>
示例5: error_reporting
<body onLoad="init()">
<div id="spiffycalendar" class="text"></div>
<!-- header //-->
<?php
require DIR_WS_INCLUDES . 'header.php';
?>
<!-- header_eof //-->
<?php
error_reporting(7);
if ($cID == "") {
echo "'cID' Can not be empty <input type=\"button\" name=\"Submit2\" value=\"hitstory\" onClick=\"javascript:history.go(-1);\" />";
exit;
}
$sql = "select * from website where web_cid=" . $cID;
$rs = mysql_query($sql);
if (MYSQL_NUMROWS($rs) == 0) {
echo "'cID' Can not be empty <a href=product_acquisition_add.php?cID=" . $cID . ">Enter</a>";
exit;
}
$web_name = mysql_result($rs, 0, "web_name");
$coding = mysql_result($rs, 0, "web_coding");
$fun_name = mysql_result($rs, 0, "web_fun_name");
$fun = mysql_result($rs, 0, "web_fun_content");
$content = mysql_result($rs, 0, "web_fun_remarks");
$replacement = mysql_result($rs, 0, "web_replace");
$discount1 = mysql_result($rs, 0, "web_fun_a");
$discount2 = mysql_result($rs, 0, "web_fun_b");
$testurl = mysql_result($rs, 0, "web_test_url");
//$testurl = str_replace("&","||||||",str_replace("?","______",$testurl));
$arr_fun_name = split(", ", $fun_name);
$arr_fun = split(", ", $fun);
示例6: setSEO
function setSEO($lang, $file, $title, $des, $keywords = '')
{
$des = strip_tags($des);
$title = strip_tags($title);
$sql = "SELECT * FROM seo WHERE filename = '{$file}' ";
$result = MYSQL_QUERY($sql);
$numberOfRows = MYSQL_NUMROWS($result);
if ($numberOfRows > 0) {
$SQL = "UPDATE seo SET title_" . $lang . " = '{$title}' , keywords_" . $lang . " = '{$keywords}' , description_" . $lang . " = '{$des}' WHERE filename = '{$file}' ";
$result = mysql_query($SQL);
} else {
$SQL = "INSERT INTO seo (filename , title_" . $lang . " , keywords_" . $lang . " , description_" . $lang . " ) VALUES \n\t\t('{$file}' , '{$title}' , '{$keywords}' , '{$des}')";
$result = mysql_query($SQL);
}
}
示例7: date
<?
include 'kart2.php';
?>
</TD>
<TD valign="top" width="100%">
<br>
<span class="tittel">Informasjon om innmeldt sak</span><br><br>
<?
include 'config.php';
//
$today = date("Ymd");
$query = "select * from fiksgrafitti where id = $id";
$result = MYSQL_QUERY($query);
$number = MYSQL_NUMROWS($result);
MYSQL_CLOSE();
// lag HTML
if ($number == 0)
{
print " <table width=\"100%\" border=0 bgcolor=\"#ffffff\>\n";
print "<tr>\n";
print "<td class=\"tittel\">Det er ikke registrert noen saker</td>\n";
print "</tr>\n";
print " </table>\n";
}
else
{
$i = 0;
WHILE ($i < $number):
示例8: show_all_history_stat
//.........這裏部分代碼省略.........
$o2 = "?o=siteA";
$b1 = "#93BEE2";
$b2 = "#FFFFFF";
$p1 = "<A HREF=\"index.php{$o1}\"><IMG ALT=\"{$web_client_order_desc}\" BORDER=0 HEIGHT=7 WIDTH=7 SRC=../images/desc.gif></A> ";
$p2 = "";
break;
case "sizeA":
$orderby = "size ASC";
$o1 = "?o=sizeD";
$o2 = "?o=siteA";
$b1 = "#93BEE2";
$b2 = "#FFFFFF";
$p1 = "<A HREF=\"index.php{$o1}\"><IMG ALT=\"{$web_client_order_asc}\" BORDER=0 HEIGHT=7 WIDTH=7 SRC=../images/asc.gif></A> ";
$p2 = "";
break;
case "siteD":
$orderby = "site DESC";
$o1 = "?o=sizeA";
$o2 = "?o=siteA";
$b1 = "#FFFFFF";
$b2 = "#93BEE2";
$p1 = "";
$p2 = "<A HREF=\"index.php{$o2}\"><IMG ALT=\"{$web_client_order_desc}\" BORDER=0 HEIGHT=7 WIDTH=7 SRC=../images/desc.gif></A> ";
break;
case "siteA":
$orderby = "site ASC";
$o1 = "?o=sizeA";
$o2 = "?o=siteD";
$b1 = "#FFFFFF";
$b2 = "#93BEE2";
$p1 = "";
$p2 = "<A HREF=\"index.php{$o2}\"><IMG ALT=\"{$web_client_order_asc}\" BORDER=0 HEIGHT=7 WIDTH=7 SRC=../images/asc.gif></A> ";
break;
default:
$orderby = "size DESC";
$o1 = "?o=sizeA";
$o2 = "?o=siteA";
$b1 = "#93BEE2";
$b2 = "#FFFFFF";
$p1 = "<A HREF=\"index.php{$o1}\"><IMG ALT=\"{$web_client_order_asc}\" BORDER=0 HEIGHT=7 WIDTH=7 SRC=../images/asc.gif></A> ";
$p2 = "";
}
echo "<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0>";
echo "<TR>";
echo "<TD BGCOLOR=#93BEE2>";
echo "<TABLE BORDER=0 CELLPADDING=1 CELLSPACING=1>";
echo "<TR>";
echo "<TD ALIGN=CENTER BGCOLOR={$b1}>{$p1}<B><A HREF=\"index.php{$o1}&type=allshist&utime={$utime}\" STYLE=\"color:#000000; text-decoration: underline\">{$web_client_downloaded}</A></B></TD>";
echo "<TD ALIGN=CENTER BGCOLOR={$b2}>{$p2}<B><A HREF=\"index.php{$o2}&type=allshist&utime={$utime}\" STYLE=\"color:#000000; text-decoration: underline\">{$web_client_site}</A></B></TD>";
#echo "<TD ALIGN=CENTER BGCOLOR=#bfbfbf><B>$web_client_futime</B></TD>";
#echo "<TD ALIGN=CENTER BGCOLOR=#bfbfbf><B>$web_client_lutime</B></TD>";
echo "</TR>";
#$res = mysql_query("SELECT * FROM site WHERE u_id=$id ORDER BY $orderby", $link);
#$res = mysql_query("SELECT u_id, utime, qtime, ip_addr, code, size, url FROM detail WHERE url like('%".mysql_escape_string($site)."%') ORDER BY $orderby limit ".($page*$pagestep).",$pagestep", $link);
#$res = mysql_query("SELECT * FROM site ORDER BY $orderby LIMIT ".($page*$pagestep).",$pagestep", $link);
$res = mysql_query("SELECT s.site as site, s.size as size FROM uhistory u, shistory s WHERE u.utime={$utime} and u.id=s.uh_id ORDER BY {$orderby} LIMIT " . $page * $pagestep . ",{$pagestep}", $link);
#$res = mysql_query("SELECT s.site as site, s.size as size FROM uhistory u, shistory s WHERE u.utime=$utime and u.id=s.uh_id LIMIT ".($page*$pagestep).",$pagestep", $link);
#$res = mysql_query("SELECT s.site as site, s.size as size FROM uhistory u, shistory s WHERE u.utime=$utime and u.id=s.uh_id", $link);
#$res = mysql_query("SELECT * FROM shistory ORDER BY $orderby LIMIT ".($page*$pagestep).",$pagestep", $link);
if (!$res) {
return 3;
}
for ($i = 0; $i < MYSQL_NUMROWS($res); $i++) {
$site = mysql_result($res, $i, "site");
$size = mysql_result($res, $i, "size");
#$lutime = mysql_result($res,$i,"lutime");
#$futime = mysql_result($res,$i,"futime");
echo "<TR>\n<TD BGCOLOR=#FFF7E5 ALIGN=RIGHT>" . dotize($size) . "</TD>\n<TD BGCOLOR=#FFF7E5>";
if ($detailed == 1) {
if ($mode == "admin") {
//{echo "<a href=\"index.php?id=$id&type=detail&site=$site\">";}
//{echo "<a href=\"index.php?type=alldetail&site=$site\">";}
// else
//{echo "<a href=\"index.php?type=detail&site=$site\">";};
//{echo "<a href=\"index.php?type=alldetail&site=$site\">";};
echo "{$site}";
}
}
if ($detailed == 1) {
echo "</a>";
}
#echo "<TD BGCOLOR=#FFF7E5>".strftime ("%B %d, %T", (int)$futime)."</TD>";
#echo "<TD BGCOLOR=#FFF7E5>".strftime ("%B %d, %T", (int)$lutime)."</TD>";
echo "</TD></TR>";
}
echo "</TABLE></TD>\n</TR>\n</TABLE>\n";
#$res = mysql_query("SELECT SUM(size) FROM site WHERE u_id=$id", $link);
#$res = mysql_query("SELECT SUM(size) FROM site", $link);
#$res = mysql_query("SELECT SUM(size) FROM shistory", $link);
$res = mysql_query("SELECT SUM(s.size) as size FROM uhistory u, shistory s WHERE u.utime={$utime} and u.id=s.uh_id", $link);
$sum = mysql_result($res, 0);
#$res = mysql_query("SELECT count(site) FROM site WHERE u_id=$id", $link);
#$res = mysql_query("SELECT count(site) FROM site", $link);
#$res = mysql_query("SELECT count(site) FROM shistory", $link);
$res = mysql_query("SELECT SUM(s.site) as site FROM uhistory u, shistory s WHERE u.utime={$utime} and u.id=s.uh_id", $link);
$sites = mysql_result($res, 0);
mysql_close();
echo "<BR><SPAN CLASS=\"smalltext\"><B>{$word_total}:</B> " . dotize($sum) . " {$word_byte} {$web_client_downloaded_from} {$sites} {$web_client_sites_wrd}.</SPAN>";
return true;
}
示例9: UniversalFeedCreator
$parser->set_option('XML_OPTION_TRIM_DATA_NODES');
// Set the handlers
$parser->set_element_handler('openHandler', 'closeHandler');
// Parse the document
$parser->parse($html);
// Begin creation of the RSS feed.
$rss = new UniversalFeedCreator();
$rss->title = $blogtitle;
$rss->description = $blogexp;
$rss->link = $blogurl;
$rss->syndicationURL = $blogrss;
$rss->copyright = strftime("%Y") . " " . $blogauthor;
// Grab the most recent 100 of the cached URLs (i.e. building permit summaries) from the MySQL table.
$query = "SELECT url,heading,dateadded,filesize from permitcache order by dateadded DESC limit 10";
$result = MYSQL_QUERY($query);
$howmanyrecords = MYSQL_NUMROWS($result);
$currentrecord = 0;
while ($currentrecord < $howmanyrecords) {
$url = mysql_result($result, $currentrecord, "url");
$heading = mysql_result($result, $currentrecord, "heading");
$dateadded = mysql_result($result, $currentrecord, "dateadded");
$filesize = mysql_result($result, $currentrecord, "filesize");
// Parse apart the date into its component parts.
list($date, $time) = explode(" ", $dateadded);
list($year, $month, $day) = explode("-", $date);
list($hour, $minute, $second) = explode(":", $time);
$date_number = mktime($hour, $minute, $second, $month, $day, $year);
// Add a channel item to the RSS feed.
$item = new FeedItem();
$item->title = $heading . " Building Permit Summary";
$item->link = "http://www.city.charlottetown.pe.ca/" . $url;
示例10: WHERE
?>
<input type='submit' style='width:200px; margin-left:15px;' name='id' value='Friends' >
<?php
}
?>
</td>
</tr>
</table>
<table class="table2" style="margin-top:10px;">
<tr>
<td>
<?php
$o = "SELECT * FROM friends WHERE(friend_one ='{$member_id}' OR friend_two ='{$member_id}') AND status='1'";
$rsut = mysql_query($o);
$numberOfRows = MYSQL_NUMROWS($rsut);
echo '<a href=friendsfriends.php?id=' . $row["user_id"] . '>' . "Friends" . ' (' . $numberOfRows . ')' . '</a>';
?>
</td>
</tr>
</table>
<br />
</nav>
<?php
include 'mainpage1.php';
?>
</body>
</html>
示例11: mysql_query
<p class="graph_type">User</p>
</div>
<div class="graph_previous">
<p class="graph_day"></p>
<p class="graph_count"><?php
//echo "On";
?>
</p>
<p class="graph_type"></p>
</div>
</article>
<?php
$cw = mysql_query("SELECT * FROM user_details WHERE join_date=' " . date('Y-m-d') . "'");
$no = MYSQL_NUMROWS($cw);
$wc = mysql_query("SELECT * FROM user_details");
$on = MYSQL_NUMROWS($wc);
?>
<article class="stats_overview">
<div class="overview_today">
<p class="overview_day">Registered Today</p>
<p class="overview_count"><?php
echo $no;
?>
</p>
<p class="overview_type">User</p>
</div>
<div class="overview_previous">
<p class="overview_day">Total</p>
<p class="overview_count"><?php
echo $on;
示例12: floor
$days = floor($row['TimeSpent'] / (60 * 60 * 24));
$remainder = $row['TimeSpent'] % (60 * 60 * 24);
$hours = floor($remainder / (60 * 60));
$remainder = $remainder % (60 * 60);
$minutes = floor($remainder / 60);
$seconds = $remainder % 60;
if ($days > 0) {
echo date('F d Y', $row['date_created']);
} elseif ($days == 0 && $hours == 0 && $minutes == 0) {
echo "few seconds ago";
} elseif ($days == 0 && $hours == 0) {
echo $minutes . ' minutes ago';
}
echo '</font><br />';
$qqq = mysql_query("SELECT * FROM postcomment WHERE post_id='" . $row['post_id'] . "'");
$numberOfRows = MYSQL_NUMROWS($qqq);
if ($numberOfRows > 0) {
if ($numberOfRows == 1) {
echo '<a HREF="postcomment.php?pid=' . $row['post_id'] . '"><small>1 comment</small></a>';
}
if ($numberOfRows == 3 || $numberOfRows == 2) {
echo '<a HREF="postcomment.php?pid=' . $row['post_id'] . '"><small>' . $numberOfRows . " comments</small></a>";
}
if ($numberOfRows >= 4) {
echo '<a HREF="postcomment.php?pid=' . $row['post_id'] . '"><small>(' . $numberOfRows . ')View all comments</small></a>';
}
}
echo '<br /><br />';
$query1 = "SELECT *,\n\t\tUNIX_TIMESTAMP() - date_created AS CommentTimeSpent FROM postcomment WHERE post_id=" . $row['post_id'] . " ORDER BY comment_id ASC LIMIT 3";
$result1 = mysql_query($query1);
while ($row1 = mysql_fetch_assoc($result1)) {
示例13: getTopParent
function getTopParent($pageLang, $menu_id)
{
$curr = $menu_id;
while ($curr != 0) {
$menu = MYSQL_QUERY("SELECT p_id FROM menus WHERE (lang = '{$pageLang}') AND menu_id={$curr}");
//echo ("SELECT p_id FROM menus WHERE (lang = '$pageLang') AND menu_id=$curr");
if (MYSQL_NUMROWS($menu) == 0) {
return 0;
}
$p_id = MYSQL_RESULT($menu, 0, "p_id");
if ($p_id == 0) {
return $curr;
} else {
$curr = $p_id;
}
}
return 0;
}
示例14: mysql_query
//echo '<font size="2" color="red"><b>(' . $numofmsg . ')</b></font>';
?>
</a></td>
</tr>
<tr>
<td><a href="friend_list.php">Request <?php
$c = mysql_query("SELECT * FROM friends WHERE(friend_two ='{$userid}') AND status='0'");
$numberOfRows = MYSQL_NUMROWS($c);
echo '<font size="2" color="red"><b>(' . $numberOfRows . ')</b></font>';
?>
</a></td>
</tr>
<tr>
<td><a href="allfriends.php">All Friends <?php
$c = mysql_query("SELECT * FROM friends WHERE(friend_two ='{$userid}' or friend_one ='{$userid}') AND status='1'");
$numberOfRows = MYSQL_NUMROWS($c);
echo '<font size="2" color="red"><b>(' . $numberOfRows . ')</b></font>';
?>
</a></td>
</tr>
<tr>
<td><a href="find_friends.php">Find Friends</a></td>
</tr>
</table>
<br />
<hr />
<div class="notify">
<h3>Notifications</h3>
<marquee direction="up" onmouseover="this.stop()" onmouseout="this.start()">
<?php
$noti = mysql_query("SELECT * from event WHERE people = '{$userid}' or people = 'ALL'");
示例15: header
<?php
header("Cache-Control: no-cache, must-revalidate");
include "../../../configure.php";
$connect = @mysql_pconnect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD) or die('could not connect:' . mysql_error());
mysql_select_db(DB_DATABASE) or die('no' . mysql_error());
$search = trim($_POST['search']);
$sql = "select products_keyword_title from products_keyword where products_keyword_title like '" . $search . "%' order by products_keyword_hits desc";
$rs = mysql_query($sql);
$num = MYSQL_NUMROWS($rs);
$str = '';
if ($num > 10) {
$num = 10;
}
for ($i = 0; $i < $num; $i++) {
$str .= '<div id="search_result" class="suggest_link" style="cursor:pointer;" onmouseover="javascript:suggestOver(this);" onmouseout="javascript:sugggestOut(this);" onclick="javascript:setSearch(this.innerHTML);">' . mysql_result($rs, $i, "products_keyword_title") . '</div>';
}
echo $str;