本文整理汇总了PHP中DB_CONNECT::fetch_array方法的典型用法代码示例。如果您正苦于以下问题:PHP DB_CONNECT::fetch_array方法的具体用法?PHP DB_CONNECT::fetch_array怎么用?PHP DB_CONNECT::fetch_array使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DB_CONNECT
的用法示例。
在下文中一共展示了DB_CONNECT::fetch_array方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: substr
// convert the number
$original_number = $number["phonenumber"];
if ($original_number[0] == '0') {
$number = substr($original_number, 1);
$original_number = "+91" . $number;
} else {
if ($original_number[0] == '+') {
// do nothing every thing is fine
} else {
$original_number = "+91" . $original_number;
}
}
$query_string = "SELECT * FROM login WHERE id = '{$original_number}'";
$result = $db->query_db($query_string);
if ($db->number_of_rows($result) > 0) {
$row = $db->fetch_array($result);
// If number["phonenumber"] is found in the login table...
// Check if it is already added or not...
$query_string2 = "SELECT * FROM family WHERE family_id = '{$original_number}'\n\t\t\t\t\t\t\t\t && member_id = '{$id}'";
$result2 = $db->query_db($query_string2);
if ($db->number_of_rows($result2) > 0) {
} else {
$query_string3 = "INSERT INTO family(member_id,family_id) VALUES('{$id}','{$original_number}')";
$result3 = $db->query_db($query_string3);
}
}
}
$queryString = "SELECT * FROM family,login WHERE member_id = '{$id}' && id = family_id";
$result = $db->query_db($queryString);
$addednumbers = array();
if ($db->number_of_rows($result) > 0) {
示例2: while
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();
} else {
//echo " No tables created by admin";
示例3: array
<?php
require_once "includes/db_connect.php";
require_once "includes/functions.php";
$response = array();
$db = new DB_CONNECT();
if (isset($_POST["id"]) && isset($_POST["phonenumber"])) {
$id = $_POST["id"];
$number = $_POST["phonenumber"];
$query = "SELECT * FROM family WHERE member_id = '{$number}' && family_id = '{$id}'";
$result = $db->query_db($query);
if ($db->number_of_rows($result) > 0) {
$row = $db->fetch_array($result);
$permission = $row["permission_given"];
if ($permission == 1) {
// now get the position of the specified user
$query1 = "SELECT * FROM login where id = '{$number}'";
$result1 = $db->query_db($query1);
if ($db->number_of_rows($result1) > 0) {
$row = $db->fetch_array($result1);
$response["success"] = 1;
$response["latitude"] = $row["latitude"];
$response["longitude"] = $row["longitude"];
$response["message"] = "You can access his location";
}
} else {
// permission is 0
$response["success"] = 0;
$response["message"] = "The user has not provied the accces to its location";
}
} else {
示例4: array
} 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>
<title> Test Details</title>
<meta charset="UTF-8">
示例5: 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;