本文整理汇总了PHP中mysql_num_rows函数的典型用法代码示例。如果您正苦于以下问题:PHP mysql_num_rows函数的具体用法?PHP mysql_num_rows怎么用?PHP mysql_num_rows使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mysql_num_rows函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getEventbriteEvents
function getEventbriteEvents($eb_keywords, $eb_city, $eb_proximity)
{
global $eb_app_key;
$xml_url = "https://www.eventbrite.com/xml/event_search?...&within=50&within_unit=M&keywords=" . $eb_keywords . "&city=" . $eb_city . "&date=This+month&app_key=" . $eb_app_key;
echo $xml_url . "<br />";
$xml = simplexml_load_file($xml_url);
$count = 0;
// loop over events from eventbrite xml
foreach ($xml->event as $event) {
// add event if it doesn't already exist
$event_query = mysql_query("SELECT * FROM events WHERE id_eventbrite={$event->id}") or die(mysql_error());
if (mysql_num_rows($event_query) == 0) {
echo $event_id . " ";
// get event url
foreach ($event->organizer as $organizer) {
$event_organizer_url = $organizer->url;
}
// get event address
foreach ($event->venue as $venue) {
$event_venue_address = $venue->address;
$event_venue_city = $venue->city;
$event_venue_postal_code = $venue->postal_code;
}
// get event title
$event_title = str_replace(array("\r\n", "\r", "\n"), ' ', $event->title);
// add event to database
mysql_query("INSERT INTO events (id_eventbrite, \n title,\n created, \n organizer_name, \n uri, \n start_date, \n end_date, \n address\n ) VALUES (\n '{$event->id}',\n '" . parseInput($event_title) . "',\n '" . strtotime($event->created) . "',\n '" . trim(parseInput($event->organizer->name)) . "',\n '{$event_organizer_url}',\n '" . strtotime($event->start_date) . "',\n '" . strtotime($event->end_date) . "',\n '{$event_venue_address}, {$event_venue_city}, {$event_venue_postal_code}'\n )") or die(mysql_error());
}
$count++;
}
}
示例2: __construct
public function __construct($query, &$conn, &$orm = null)
{
$this->conn = $conn;
$this->res = null;
$this->orm = $orm;
$this->rowOrm = null;
$this->success = false;
$this->fields = null;
$this->EOF = true;
$this->BOF = true;
$this->index = 0;
$this->count = 0;
$this->insertID = 0;
$type = strtolower(substr(trim(str_replace("\n", " ", $query)), 0, 7));
$typeIsSelect = $type == "select ";
$typeIsShowTables = $type == "show ta";
$typeIsInsert = $type == "insert ";
$query = Str::finish($query, ";");
if ($this->res = @mysql_query($query, $this->conn->res)) {
$this->success = true;
if ($typeIsSelect || $typeIsShowTables) {
$this->count = mysql_num_rows($this->res);
$this->moveFirst();
} else {
if ($typeIsInsert) {
$this->insertID = mysql_insert_id($this->conn->res);
}
}
} else {
trigger_error("SQL error: " . $query . "\n<br><b>'" . mysql_error($this->conn->res) . "'</b>");
}
}
示例3: logincheck
function logincheck($logincode, $users_table, $pass_column, $user_column)
{
//conect to DB
$this->dbconnect();
//make sure password column and table are set
if ($this->pass_column == "") {
$this->pass_column = $pass_column;
}
if ($this->users_column == "") {
$this->users_column = $users_column;
}
if ($this->users_table == "") {
$this->users_table = $users_table;
}
//exectue query
$result = $this->qry("SELECT * FROM " . $this->users_table . " WHERE " . $this->pass_column . " = '?';", $logincode);
$rownum = mysql_num_rows($result);
//return true if logged in and false if not
if ($row != "Error") {
if ($rownum > 0) {
return true;
} else {
return false;
}
}
}
示例4: modul
function modul($posisi)
{
global $koneksi_db, $STYLE_INCLUDE, $SCRIPT_INCLUDE;
$total = 0;
$numb = 0;
if (isset($_GET['pilih'])) {
$pilih = mysql_real_escape_string(strip_tags($_GET['pilih']));
$numb = mysql_num_rows(mysql_query("SELECT `id` FROM `actions` WHERE `modul_hrd` = '{$pilih}'"));
$modulku = mysql_query("SELECT * FROM `actions` LEFT JOIN `modul_hrd` ON (`modul_hrd`.`id` = `actions`.`modul_id`) WHERE `actions`.`modul_hrd` = '{$pilih}' AND `actions`.`posisi` = '{$posisi}' ORDER BY `actions`.`order`");
$total = mysql_num_rows($modulku);
while ($viewmoduls = mysql_fetch_assoc($modulku)) {
if (file_exists($viewmoduls['isi']) && $viewmoduls['type'] == 'module') {
include $viewmoduls['isi'];
kotakjudul($viewmoduls['modul'], @$out, '');
$out = '';
}
if ($viewmoduls['type'] == 'block') {
kotakjudul($viewmoduls['modul'], $viewmoduls['isi'], '');
}
}
}
if ($total == 0 && $numb == 0) {
$modulku = $koneksi_db->sql_query("SELECT * FROM modul_hrd WHERE published= 1 AND posisi= '{$posisi}' ORDER BY ordering");
while ($viewmodul = $koneksi_db->sql_fetchrow($modulku)) {
if (file_exists($viewmodul['isi']) && $viewmodul['type'] == 'module') {
include $viewmodul['isi'];
kotakjudul($viewmodul['modul'], @$out, '');
$out = '';
}
if ($viewmodul['type'] == 'block') {
kotakjudul($viewmodul['modul'], $viewmodul['isi'], '');
}
}
}
}
示例5: get_project_level
function get_project_level($user_id, $project_id, $validate = true)
{
// Most of the data comes from outside sources, so it is easier to validate it now, but if it doesn't or
// we already have validated it, its a waste of server resources to do it again
if ($validate) {
$project_id = preg_replace("[^0-9]", "", $project_id);
}
// Check whether this user has any special permissions for this project
$query = "SELECT * FROM project_users WHERE user_id = '{$user_id}' AND project_id = '{$project_id}'";
$result = mysql_query($query);
// If there are no special permissions, lets see what the standard ones are
if (mysql_num_rows($result) == 0) {
$query = "SELECT * FROM projects WHERE id = '{$project_id}'";
$result = mysql_query($query);
// Check whether the project exists
if (mysql_num_rows($result) == 0) {
// And if it doesn't, return false
return false;
} else {
// But if it does, return the level!
$level = mysql_result($result, 0, "default_level");
}
} else {
$level = mysql_result($result, 0, "level");
}
return $level;
}
示例6: selectrec
function selectrec($fields, $table, $cond = "")
{
$a = array();
$query = "select " . $fields . " from " . $table;
if (!($cond == "")) {
$query = $query . " where " . $cond;
}
//echo "<br>".$query;
$result = mysql_query($query);
//echo mysql_error();
//if (mysql_error()!="")
//echo "<br>".$query;
$numrows = mysql_num_rows($result);
$numfields = mysql_num_fields($result);
$i = $j = 0;
while ($i < $numrows) {
while ($j < $numfields) {
$a[$i][$j] = mysql_result($result, $i, mysql_field_name($result, $j));
$j++;
}
$i++;
$j = 0;
}
mysql_free_result($result);
return $a;
}
示例7: show_abts
function show_abts($dbh)
{
global $msg;
global $charset;
print "<table>\n\t\t<tr>\n\t\t<th>" . $msg[103] . "</th>\n\t\t<th style='display:none'>" . $msg["type_abts_prepay"] . "</th>\n\t\t<th style='display:none'>" . $msg["type_abts_prepay_dflt"] . "</th>\n\t\t<th>" . $msg["type_abts_tarif"] . "</th>\n\t\t<th>" . $msg["type_abts_caution"] . "</th>\n\t\t</tr>";
// affichage du tableau des utilisateurs
$requete = "SELECT id_type_abt, type_abt_libelle, prepay, prepay_deflt_mnt,tarif,caution FROM type_abts ORDER BY type_abt_libelle,id_type_abt";
$res = mysql_query($requete, $dbh);
$nbr = mysql_num_rows($res);
$parity = 1;
for ($i = 0; $i < $nbr; $i++) {
$row = mysql_fetch_row($res);
if ($row[2]) {
$prepay = "x";
}
if ($parity % 2) {
$pair_impair = "even";
} else {
$pair_impair = "odd";
}
$parity += 1;
$tr_javascript = " onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='{$pair_impair}'\" onmousedown=\"document.location='./admin.php?categ=finance&sub=abts&action=modif&id={$row['0']}';\" ";
print pmb_bidi("<tr class='{$pair_impair}' {$tr_javascript} style='cursor: pointer'><td>" . htmlentities($row[1], ENT_QUOTES, $charset) . "</td>\n\t\t\t<td style='text-align:center;display:none'>{$prepay}</td><td style='display:none'>" . $row[3] . "</td><td>" . $row[4] . "</td><td>" . $row[5] . "</td>\n\t\t\t\t\t\t</tr>");
}
print "</table>\n\t\t<input class='bouton' type='button' value=\" " . $msg["type_abts_add"] . " \" onClick=\"document.location='./admin.php?categ=finance&sub=abts&action=add'\" />";
}
示例8: get_all_promo_events
function get_all_promo_events()
{
connect_and_select_db(DB_SERVER, DB_UN, DB_PWD, DB_NAME);
$startDate = mysql_real_escape_string($_POST['startDate']);
$endDate = mysql_real_escape_string($_POST['endDate']);
//Retrieve all events that occur during the time period including the outer bounds
if ($startDate == null || $startDate == "") {
$startDate = "0000-00-00";
}
if ($endDate == null || $endDate == "") {
$endDate = "9999-99-99";
}
//$startDate = str_replace("-", "", $startDate);
//$endDate = str_replace("-", "", $endDate);
$sql = "SELECT * FROM AdEvent WHERE " . "(StartDate >= '{$startDate}' " . "AND StartDate <= '{$endDate}') " . "OR (EndDate >= '{$startDate}' " . "AND EndDate <= '{$endDate}') " . "ORDER BY AdEvent.StartDate ASC;";
//$sql = "SELECT * FROM AdEvent ORDER BY AdEvent.StartDate ASC"; --older, incorrect version
$error_message = "Could not successfully run query ({$sql}) from DB: ";
$search_events_result = get_result_set_from_select_query($sql, $error_message);
//$result is non-empty. So count the rows
$numrows = mysql_num_rows($search_events_result);
//Create an appropriate message
$message = "";
if ($numrows == 0) {
$message = "No events found in database";
}
ui_show_events_retrieved($message, $search_events_result);
}
示例9: rewind
function rewind()
{
if ($this->resource && mysql_num_rows($this->resource) > 0) {
mysql_data_seek($this->resource, 0);
}
$this->number = 0;
}
示例10: phantrang
function phantrang($page, $max_results, $page_number, $search)
{
global $sql;
$from = $page_number * $max_results - $max_results;
$link = "administrator.php?p={$page}&page_number=";
$type = 6;
//loại sql select $type = 6;
$table = $page;
$field = array('id');
$sql->get_sql($type, $table, $field, $search);
$qr = $sql->executable() or die('<p class="error">Không truy vấn được</p>');
$total = mysql_num_rows($qr);
mysql_free_result($qr);
$total_pages = ceil($total / $max_results);
if ($total_pages > 1) {
if ($page_number > 1) {
$prev = $page_number - 1;
echo "<a href='{$link}{$prev}'>Trang trước</a>";
}
for ($i = $page_number - 5; $i <= $page_number + 5 & $i <= $total_pages; $i++) {
if ($page_number == $i) {
echo "<a href='{$link}{$i}' style='color:#F00; font-weight:bold; background-color:#ffffcc'>{$i}</a>";
} elseif ($i > 0) {
echo "<a href='{$link}{$i}'>{$i}</a>";
}
}
if ($page_number < $total_pages) {
$next = $page_number + 1;
echo "<a href='{$link}{$next}'>Trang sau</a>";
}
}
}
示例11: show_zbib
function show_zbib($dbh)
{
global $msg;
print "<table>\n\t\t<tr>\n\t\t<th class='titre_data'>{$msg['zbib_nom']}</th>\n\t\t<th class='titre_data'>{$msg['zbib_base']}</th>\n\t\t<th class='titre_data'>{$msg['zbib_utilisation']}</th>\n\t\t<th class='titre_data'>{$msg['zbib_nb_attr']}</th>\n\t\t</tr>";
// affichage du tableau des z_bib
$requete = "SELECT bib_id, bib_nom, base, search_type, count(*) as nb_attr FROM z_bib left outer join z_attr on bib_id=attr_bib_id group by bib_id, bib_nom, base, search_type ORDER BY bib_nom, base, search_type ";
$res = mysql_query($requete, $dbh);
$nbr = mysql_num_rows($res);
$parity = 1;
for ($i = 0; $i < $nbr; $i++) {
$row = mysql_fetch_object($res);
if ($parity % 2) {
$pair_impair = "even";
} else {
$pair_impair = "odd";
}
$parity += 1;
$tr_javascript = " onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='{$pair_impair}'\" onmousedown=\"document.location='./admin.php?categ=z3950&sub=zbib&action=modif&id={$row->bib_id}';\" ";
print "<tr class='{$pair_impair}' {$tr_javascript} style='cursor: pointer'>";
print "<td><strong>" . $row->bib_nom . "</strong></td>";
print "<td>" . $row->base . "</td>";
print "<td>" . $row->search_type . "</td>";
print "<td>" . $row->nb_attr . "</td>";
print "</tr>";
}
print "</table>\n\t\t<input class='bouton' type='button' value='" . $msg["ajouter"] . "' onClick=\"document.location='./admin.php?categ=z3950&sub=zbib&action=add'\" />\n\t\t";
}
示例12: authentication
public static function authentication()
{
// print_r($_SERVER);
// exit();
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="My Realm"');
header('HTTP/1.0 401 Unauthorized');
echo 'Text to send if user hits Cancel button';
exit;
} else {
$db = new DB();
$username = mysql_real_escape_string($_SERVER['PHP_AUTH_USER']);
$password = mysql_real_escape_string($_SERVER['PHP_AUTH_PW']);
$domain = 'nebula.com';
$hash = md5($username . ':' . $domain . ':' . $password);
$sql = "SELECT id from n_nebulauser WHERE username='{$username}' AND ha1='{$hash}'";
$q = $db->query($sql);
if (mysql_num_rows($q)) {
$fetch = mysql_fetch_assoc($q);
return $fetch['id'];
} else {
return null;
}
}
return false;
}
示例13: Content
protected function Content()
{
?>
<div class="container">
<div class="row ajax">
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
<?php
$hash = $_GET['hash'];
if ($hash != "") {
$conn = $this->ConnectDB();
// шукаєм хеш в базі
$result = mysql_query("SELECT id FROM user WHERE hash = '{$hash}'");
$num_rows = mysql_num_rows($result);
// якщо хеш знайдений - активуєм, чистим хеш
if ($num_rows > 0) {
$conn = $this->ConnectDB();
$result = mysql_query("UPDATE user SET status = 1, hash = '' WHERE hash = '{$hash}'");
echo "<center><br><a href='../index.php'>Активація пройшла успішно. Вернутись на головну.</a></center>";
} else {
echo "<center><br><a href='../index.php'>Помилка. Вернутись на головну.</a></center>";
}
} else {
echo "<center><br><a href='../index.php'>Невірний лінк. Вернутись на головну.</a></center>";
}
?>
</div>
</div>
</div>
</body>
</html>
<?php
}
示例14: isUser
public function isUser($name, $pass)
{
if (!$this->isConnected()) {
return;
}
/*
$query = "SELECT * FROM Users WHERE name LIKE '$name' AND password LIKE '$pass'" ;
$res = mysql_query($query,$this->link);
*/
$res = $this->queryLoad("SELECT * FROM Users WHERE name LIKE '{$name}' AND password LIKE '{$pass}'");
if (!$res) {
// Verifiacmos el error de conexion
mysql_error();
} elseif (mysql_num_rows($res) <= 0) {
// en caso de que no regrese resultados
header("Location: ../../index.php");
} else {
//send menu
$fila = mysql_fetch_assoc($res);
session_start();
$_SESSION['name'] = $name;
$_SESSION['password'] = $pass;
$_SESSION['id'] = $fila['id'];
$_SESSION['state'] = $fila['state'];
header("Location: ../../views/system.php");
}
}
示例15: view_all_judges
function view_all_judges($event)
{
include 'dbconnect.php';
$db_name = 'forum';
$tbl_name = 'judges';
mysql_select_db("{$db_name}") or die("cannot select DB");
$view_sql = "SELECT * FROM " . $tbl_name . " WHERE event = '" . $event . "'";
$result = mysql_query($view_sql, $conn);
echo "<table class='table table-striped'>\r\n \t<tr>\r\n \t<th>Judge Name</th>\r\n \t<th>Judge Status</th>\r\n \t<th>Date Added</th>\r\n \t<th>Operation</th>\r\n \t</tr>";
while ($row = mysql_fetch_array($result)) {
echo "<tr>";
echo "<td>" . $row['judge_name'] . "</td>";
echo "<td>" . $row['judge_status'] . "</td>";
echo "<td>" . $row['date_added'] . "</td>";
$add_remove_str = $sql_chk = "SELECT * FROM judges_final WHERE judge_name='" . $row['judge_name'] . "' and event='" . $row['event'] . "'";
$res = mysql_query($sql_chk);
// Mysql_num_row is counting table row
$count = mysql_num_rows($res);
// If result matched $myusername and $mypassword, table row must be 1 row
if ($count == 0) {
$add_remove_str = "Add to FINAL list";
$onclick_str = "'javascript:add_judge_final(\"" . $row['event'] . "\",\"" . $row['judge_name'] . "\")'";
$gly = "plus";
} else {
$add_remove_str = "Remove from FINAL list";
$onclick_str = "'javascript:remove_judge_final(\"" . $row['event'] . "\",\"" . $row['judge_name'] . "\")'";
$gly = "minus";
}
echo "<td> <a style='cursor:pointer;' alt='Delete this Judge' onclick='javascript:del_judge(\"" . $row['event'] . "\",\"" . $row['judge_name'] . "\")'><span class='glyphicon glyphicon-remove'></span> Delete </a>" . "<a style='cursor:pointer;' onclick=" . $onclick_str . "> , <span class='glyphicon glyphicon-{$gly}'></span> {$add_remove_str} </a></td>";
echo "</tr>";
}
echo "</table>";
mysql_close($conn);
}