本文整理汇总了PHP中DB_CONNECT::number_of_rows方法的典型用法代码示例。如果您正苦于以下问题:PHP DB_CONNECT::number_of_rows方法的具体用法?PHP DB_CONNECT::number_of_rows怎么用?PHP DB_CONNECT::number_of_rows使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DB_CONNECT
的用法示例。
在下文中一共展示了DB_CONNECT::number_of_rows方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: trim
<?php
require_once "/includes/session.php";
require_once "/includes/db_connect.php";
require_once "/includes/functions.php";
$db = new DB_CONNECT();
$message = "";
// check and submit the user request for the access of the page
if (isset($_POST["submit"])) {
$user_id = trim($db->mysql_prep($_POST["username"]));
$password = trim($db->mysql_prep($_POST["password"]));
$hashed_password = sha1($password);
// for the hashing of the password
$queryString = "SELECT * FROM adminUser WHERE username='{$user_id}' && password='{$hashed_password}' ";
$result = $db->query_db($queryString);
if ($db->number_of_rows($result) > 0) {
$_SESSION["username"] = $user_id;
redirect_to("firstpage.php");
} else {
$message = "Passowrd and Username combination is wrong";
}
}
?>
<html lang="en" class="no-js">
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="UTF-8">
<title>DISASTER SAFETY</title>
<link rel="stylesheet" type="text/css" href="stylesheets/demo.css">
<link rel="stylesheet" type="text/css" href="stylesheets/style.css">
<link rel="stylesheet" type="text/css" href="stylesheets/animate-custom.css">
</head>
示例2: array
// query failed
echo "query failed";
} else {
redirect_to("question_list.php?test_name=" . get_test_name());
}
} else {
echo "empty fields";
}
} else {
echo "Someting was not set";
}
} else {
$db = new DB_CONNECT();
$query = "SELECT * FROM test WHERE test_name='" . get_test_name() . "' AND username='" . get_username() . "' ";
$details = $db->query_database($query);
if ($db->number_of_rows($details) > 0) {
$i = 1;
$row = $db->fetch_array($details);
$table_data = array();
$table_data["test_name"] = $row["test_name"];
$table_data["start_time"] = $row["start_time"];
$table_data["end_time"] = $row["end_time"];
$table_data["event_date"] = $row["event_date"];
$table_data["duration"] = $row["duration"];
}
}
?>
<!DOCTYPE html>
<html>
<head>
示例3: while
<?php
require_once '../includes/db_connect.php';
require_once '../includes/functions.php';
require_once '../includes/session.php';
confirm_logged_in();
$db = new DB_CONNECT();
// get username from the session
$username = get_username();
//select all test created by him from test table
if (isset($_GET["message"])) {
$message = "The Test has been deleted.";
}
$query = "SELECT test_name,start_time,end_time,event_date,duration FROM test WHERE username='{$username}'";
$admin_tests = $db->query_database($query);
if ($db->number_of_rows($admin_tests) > 0) {
$i = 1;
while ($row = $db->fetch_array($admin_tests)) {
$table_data = array();
$table_data_array[$i] = array();
$table_data["test_name"] = $row["test_name"];
$table_data["start_time"] = $row["start_time"];
$table_data["end_time"] = $row["end_time"];
$table_data["event_date"] = $row["event_date"];
$table_data["duration"] = $row["duration"];
$table_data_array[$i] = $table_data;
$i++;
}
$no_of_rows = $i - 1;
$table_data_array["number_of_rows"] = $no_of_rows;
$table_html = make_test_information_table();
示例4: urldecode
<?php
require_once '../includes/db_connect.php';
require_once '../includes/functions.php';
require_once '../includes/session.php';
confirm_logged_in();
$db = new DB_CONNECT();
// get username from the session
$username = get_username();
$test_name = urldecode($_GET['test_name']);
//select all test created by him from test table
$query = "SELECT * FROM " . $test_name . "_users";
$users_table = $db->query_database($query);
if ($db->number_of_rows($users_table) > 0) {
$i = 1;
while ($row = $db->fetch_array($users_table)) {
$table_data = array();
$table_data_array[$i] = array();
$table_data["first_name"] = $row["first_name"];
$table_data["last_name"] = $row["last_name"];
$table_data["email"] = $row["email"];
$table_data["phone_number"] = $row["phone_number"];
$table_data["score"] = $row["score"];
$table_data["questions_attempted"] = $row["questions_attempted"];
$table_data["correct_ans"] = $row["correct_ans"];
$table_data["wrong_ans"] = $row["wrong_ans"];
$table_data_array[$i] = $table_data;
$i++;
}
$no_of_rows = $i - 1;
$table_data_array["number_of_rows"] = $no_of_rows;