本文整理汇总了PHP中MySQLDatabase::fetch_array方法的典型用法代码示例。如果您正苦于以下问题:PHP MySQLDatabase::fetch_array方法的具体用法?PHP MySQLDatabase::fetch_array怎么用?PHP MySQLDatabase::fetch_array使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MySQLDatabase
的用法示例。
在下文中一共展示了MySQLDatabase::fetch_array方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: MySQLDatabase
<?php
include_layout_template('admin_menu.php');
?>
<div class="span9">
<h2>Close Form Application</h2>
<hr>
<h3>Note:</h3>
<ul>
<li>Once you close application, nobody will be able to register for any programme</li>
<li>You can also set a date the application will be closed</li>
</ul>
<?php
$database = new MySQLDatabase();
$sql = $database->query("SELECT * FROM application_status WHERE id=1");
$result = $database->fetch_array($sql);
?>
<form action="" method="POST" class="form-horizontal closeapplication" id="closeapplication" >
<div class="control-group">
<label class="control-label" for="inputClosingDate">Closing Date:</label>
<div class="controls">
<div class="input-prepend">
<span class="add-on"><i class="icon-calendar"></i></span>
<input type="text" class="input-medium datepicker" value="<?php
echo $result['application_close_date'];
?>
" id="date" name="date" maxlength="10" data-date-format="yyyy-mm-dd" placeholder="YYYY-MM-DD" />
</div>
</div>
</div>
示例2: MySQLDatabase
?>
<div class="span9">
<h2>Active Notifications</h2>
<hr>
<?php
$database = new MySQLDatabase();
$active_notifications = "SELECT * FROM `applicant_notifications` as app_not JOIN `personal_details` as per WHERE status = 1 AND recipient_id = " . $session->applicant_id . " AND app_not.sender_id=per.applicant_id";
$result = $database->query($active_notifications);
$pagecounter = 1;
$serialno = 1;
$max = 10;
$number_of_notifications = $database->num_rows($result);
echo '<div class="tabbable">
<div class="tab-content">';
while ($row = $database->fetch_array($result)) {
if ($serialno % $max == 1) {
if ($pagecounter == 1) {
echo '<div class="tab-pane active" id="' . $pagecounter . '">';
} else {
echo '<div class="tab-pane" id="' . $pagecounter . '">';
}
echo '<table class="table table-hover">
<thead>
<tr>
<th>S/N</th>
<th>Sender</th>
<th>Title</th>
<th>Date</th>
<th>Time</th>
<th></th>
示例3: Session
<?php
# Instance of Session
$session = new Session();
# Instance of MySQLDatabase
$db = new MySQLDatabase();
// print_r( $type);
// die();
# Count the number of submitted transcript applications for an applicant
$query_count = "SELECT count(*) FROM feedbacks WHERE applicant_id ='" . $session->id . "' ";
$result_count = $db->query($query_count);
$feedbacks_count = $db->fetch_array($result_count);
$count = array_shift($feedbacks_count);
// 1. the current page number ($current_page)
$page = !empty($_GET['page']) ? (int) $_GET['page'] : 1;
// 2. records per page ($per_page)
$per_page = 3;
// 3. total record count ($total_count)
$total_count = $count;
// use pagination instead
$pagination = new Pagination($page, $per_page, $total_count);
// Instead of finding all records, just find the records
// for this page
$sql = "SELECT * FROM feedbacks WHERE applicant_id ='" . $session->id . "' ORDER BY `id` DESC ";
$sql .= "LIMIT {$per_page} ";
$sql .= "OFFSET {$pagination->offset()}";
$active_feedbacks = Feedback::find_by_sql($sql);
// Need to add ?page=$page to all links we want to
// maintain the current page (or store $page in $session)
$counter = 1;
?>
示例4:
?>
" />
</div>
</div>
</div>
<div class="control-group">
<label class="control-label">Amount</label>
<div class="controls">
<div class="input-prepend">
<span class="add-on"><i class="icon-chevron-down"></i></span>
<select class="input-xlarge" name="amount" id="amount" >
<?php
$naira = '₦';
$arrayAmount = $database->query("SELECT * FROM form_amount WHERE status=1");
while ($row = $database->fetch_array($arrayAmount)) {
$amountformat = $row['amount'] * 100 . '.00';
if ($amountformat == $result->amount) {
echo '<option selected="selected" value="' . $row['amount'] . '">' . $naira . $row['amount'] . '</option>';
} else {
echo '<option value="' . $row['amount'] . '">' . $naira . $row['amount'] . '</option>';
}
}
?>
</select>
</div>
</div>
</div>
<div class="control-group">
<label class="control-label">Transaction Date</label>
示例5: MySQLDatabase
<?php
require_once '../inc/initialize.php';
$db_academic = new MySQLDatabase();
$sql_exam = "SELECT * FROM exam_id";
$result_exam = $db_academic->query($sql_exam);
while ($record = $db_academic->fetch_array($result_exam)) {
echo '<option value="' . $record['exam_type_id'] . '">' . $record['exam_name'] . '</option>';
}
示例6:
<h2>Search Form Log Transactions</h2>
<hr>
<h3>Note:</h3>
<ul>
<li>This is to search payment records in the form log transactions</li>
</ul>
<form action="" method="POST" class="form-horizontal search_acceptance" id="search_acceptance" >
<div class="input-prepend">
<span class="add-on"><i class="icon-chevron-down"></i></span>
<select class="input-large" name="approval_status" id="approval_status" >
<option selected="selected" value="">--Select Code--</option>
<?php
$arrayDescription = $database->query("SELECT * FROM interswitch_error_code WHERE status=1 ORDER BY `interswitch_error_code`.`response_description` ASC");
while ($rowDesc = $database->fetch_array($arrayDescription)) {
echo '<option value="' . $rowDesc['response_code'] . '">' . $rowDesc['response_description'] . '</option>';
}
?>
</select>
</div>
<?php
$sql_faculty = "SELECT * FROM faculty ORDER BY faculty_name ASC";
$result_set = $database->query($sql_faculty);
?>
<div class="input-prepend">
<span class="add-on"><i class="icon-chevron-down"></i></span>
<select class="input-large" name="faculty_id" id="faculty_id" onChange="get_options(this.value);" >
<option value="">--Select Programme--</option>
示例7: form_id_generator
function form_id_generator($applicant_id, $programme)
{
//get the length of random number to generate
$random_number_length = 6 - strlen($applicant_id);
//get d last two digits of the session
$database = new MySQLDatabase();
$selectsessionsql = $database->query("SELECT session FROM application_status WHERE id=1");
$result = $database->fetch_array($selectsessionsql);
$year = explode('/', $result['session']);
$year = substr($year[0], 2, 2);
$random_number = rand(pow(10, $random_number_length - 1), pow(10, $random_number_length) - 1);
// The function returns year, programme
return $year . $programme . $random_number . $applicant_id;
}
示例8: elseif
$rootdirectory = '../documents/transcripts/';
} elseif ($filetype == 'Thesis Proposal') {
$rootdirectory = '../documents/thesis/';
}
$rootdirectory .= $filename;
return $rootdirectory;
}
$applicant_id = customDecrypt($_GET[md5('applicant_id')]);
$user = new User();
$user->applicant_id = $applicant_id;
$progress = $user->find_by_sql("SELECT progress FROM personal_details WHERE applicant_id='" . $user->applicant_id . "'");
$progress = array_shift($progress);
$student_status = $user->get_student_status();
$database = new MySQLDatabase();
$personal_details = $database->query("SELECT * FROM personal_details p, title t, lga l, state s, religion r, nationality n, department d, faculty f, next_of_kin next, marital mar, photographs photo WHERE p.applicant_id='" . $applicant_id . "' AND p.title_id=t.title_id AND p.lga_id=l.lga_id AND l.state_id=s.state_id AND p.religion_id=r.religion_id AND p.country_id=n.country_id AND p.programme_applied_id=d.department_id AND d.faculty_id=f.faculty_id AND p.applicant_id=next.applicant_id AND p.applicant_id=photo.applicant_id AND p.marital_status=mar.marital_status_id");
$personal_details = $database->fetch_array($personal_details);
$admissions = new Admission();
$sql = "select * from admission_status where applicant_id='" . $applicant_id . "'";
$admissions = Admission::find_by_sql($sql);
foreach ($admissions as $admission) {
$date = $admission->date_completed_application;
$time = $admission->time_completed_application;
$academic_session = $admission->academic_session;
$status = $admission->status;
$reason = $admission->reason;
}
if ($status == 0) {
$msg = '<span class="label label-inverse">You have not completed your application form yet</span>';
} elseif ($status == 1) {
$msg = '<span class="label ">Pending</span>';
} elseif ($status == 2) {
示例9: MySQLDatabase
<?php
$database = new MySQLDatabase();
?>
<div class="row-fluid">
<div class="span3">
<div class="input-prepend">
<span class="add-on"><i class="icon-chevron-down"></i></span>
<select class="input-xlarge" name="faculty_id" id="faculty_id" onChange="get_options(this.value);" >
<?php
$arraySpecialRoles = array(2 => 12, 3 => array(16, 17));
if (isset($_SESSION['department_id']) && $_SESSION['department_id'] != 0) {
$sql_get_departmentdetails = $database->query("SELECT * FROM department d, faculty f WHERE d.department_id='" . $_SESSION['department_id'] . "' AND d.faculty_id=f.faculty_id");
$result_departmentdetails = $database->fetch_array($sql_get_departmentdetails);
echo '<option value="' . $result_departmentdetails['faculty_id'] . '">' . $result_departmentdetails['faculty_name'] . '</option>';
} elseif (array_key_exists($_SESSION['role'], $arraySpecialRoles) && $_SESSION['department_id'] == 0) {
if (is_array($arraySpecialRoles[$_SESSION['role']])) {
$sql_faculty = $database->query("SELECT * FROM faculty WHERE faculty_id='" . $arraySpecialRoles[$_SESSION['role']][0] . "' OR faculty_id='" . $arraySpecialRoles[$_SESSION['role']][1] . "'");
$output = '';
while ($result_faculty = $database->fetch_array($sql_faculty)) {
$output .= '<option value="' . $result_faculty['faculty_id'] . '">' . $result_faculty['faculty_name'] . '</option>';
}
} else {
$sql_faculty = $database->query("SELECT * FROM faculty WHERE faculty_id='" . $arraySpecialRoles[$_SESSION['role']] . "'");
$result_faculty = $database->fetch_array($sql_faculty);
$output = '<option value="' . $result_faculty['faculty_id'] . '">' . $result_faculty['faculty_name'] . '</option>';
}
echo $output;
} else {
示例10: applicant
$query_acceptance = "SELECT * FROM acceptance_log acc, personal_details p, department d, faculty f WHERE acc.student_id = p.form_id AND p.programme_applied_id = d.department_id AND f.faculty_id = d.faculty_id" . $whereclause;
//print_r($query_acceptance);
$row_count = 1;
$result = $database->query($query_acceptance);
$number_of_records = $database->num_rows($result);
if ($number_of_records > 0) {
echo '<h4 align="center"><span class="badge badge-info">' . $number_of_records . '</span> applicant(s) found</h4>';
echo '<div class="tabbable">';
//echo '<input type="hidden" value="'.$result.'" name="exportdata"/>';
echo '<div class="tab-content">';
$link_str = "";
$pagecounter = 1;
$serialno = 1;
$max = 10;
$number_of_pages = ceil($number_of_records / $max);
while ($record = $database->fetch_array($result)) {
if ($serialno % $max == 1) {
if ($pagecounter == 1) {
echo '<div class="tab-pane active" id="' . $pagecounter . '">';
} elseif ($pagecounter == 2) {
echo '<div class="tab-pane" id="' . $pagecounter . '">';
} else {
echo '<div class="tab-pane" id="' . $pagecounter . '">';
}
echo '<table class="table table-hover">
<thead>
<tr>';
// if($role == 1 || $role == 6){
// echo'<th></th>';
// }
echo '<th>S/N</th>
示例11: count
$type = 2;
break;
case 3:
$caption = 'All Notifications';
$type = '>=1';
break;
default:
break;
}
// print_r( $type);
// die();
}
# Count the number of submitted transcript applications for an applicant
$query_count = "SELECT count(*) FROM notifications WHERE applicant_id ='" . $session->id . "' AND status = '" . $type . "'";
$result_count = $db->query($query_count);
$notifications_count = $db->fetch_array($result_count);
$count = array_shift($notifications_count);
// 1. the current page number ($current_page)
$page = !empty($_GET['page']) ? (int) $_GET['page'] : 1;
// 2. records per page ($per_page)
$per_page = 3;
// 3. total record count ($total_count)
$total_count = $count;
// use pagination instead
$pagination = new Pagination($page, $per_page, $total_count);
// Instead of finding all records, just find the records
// for this page
$sql = "SELECT * FROM notifications WHERE applicant_id ='" . $session->id . "' AND status = '" . $type . "' ORDER BY `id` DESC ";
$sql .= "LIMIT {$per_page} ";
$sql .= "OFFSET {$pagination->offset()}";
$active_notifications = Notification::find_by_sql($sql);
示例12: Admission
$registra = array_shift($registra);
$admissions = new Admission();
$sql = "SELECT * FROM admission_status WHERE applicant_id='" . $session->applicant_id . "'";
$admissions = Admission::find_by_sql($sql);
foreach ($admissions as $admission) {
$time = $admission->time_completed_application;
$academic_session = $admission->academic_session;
$status = $admission->status;
}
if ($status < 5) {
redirect_to('confirmation.php');
}
$student_status = $user->get_student_status();
$database = new MySQLDatabase();
$personal_details = $database->query("SELECT * FROM personal_details p, title t, lga l, state s, religion r, nationality n, department d, faculty f, next_of_kin next, marital mar, photographs photo WHERE p.applicant_id='" . $session->applicant_id . "' AND p.title_id=t.title_id AND p.lga_id=l.lga_id AND l.state_id=s.state_id AND p.religion_id=r.religion_id AND p.country_id=n.country_id AND p.programme_applied_id=d.department_id AND d.faculty_id=f.faculty_id AND p.applicant_id=next.applicant_id AND p.applicant_id=photo.applicant_id AND p.marital_status=mar.marital_status_id");
$personal_details = $database->fetch_array($personal_details);
$admission = $database->query("SELECT * FROM `admission_letter_date` WHERE visible = 1");
$admission = $database->fetch_array($admission);
// $programme = $database->query("SELECT * FROM `department` WHERE `department_id` = ");
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>University of Jos, Nigeria - <?php
echo $personal_details['faculty_name'];
?>
Complete Application Form</title>
<?php
require_once LIB_PATH . DS . 'javascript.php';
require_once LIB_PATH . DS . 'css.php';
示例13: MySQLDatabase
<?php
require_once "../../inc/initialize.php";
$database = new MySQLDatabase();
if (isset($_POST)) {
$acceptance_log = new AcceptanceLog();
$acceptance_log->student_id = $_POST['applicant_number'];
$acceptance_log->ResponseCode = $_POST['response_code'];
$result = $database->query("SELECT * FROM `interswitch_error_code` WHERE `response_code` = '" . $acceptance_log->ResponseCode . "'");
$result = $database->fetch_array($result);
$acceptance_log->ResponseDescription = $result['response_description'];
$acceptance_log->PaymentReference = $_POST['payment_reference'];
$acceptance_log->Amount = $_POST['amount'];
$acceptance_log->returned_amount = $_POST['amount'] * 100 . ".00";
$acceptance_log->status = $_POST['student_status'];
if ($acceptance_log->save()) {
echo '<h4 class="alert alert-success">Success</h4>';
echo '<hr>';
echo "<p>You have successfully added a new record into acceptance log for applicant with application number: " . $acceptance_log->student_id . ".</p>";
echo '<hr>';
} else {
echo '<h4 class="alert alert-error">Error</h4>';
echo '<hr>';
echo "Failed to insert into acceptance log.";
echo '<hr>';
}
}
示例14: pd_get_total
break;
case 3:
break;
case 7:
break;
case 9:
break;
default:
redirect_to('home.php');
break;
}
$db = new MySQLDatabase();
if ($role == 4) {
$sql = "SELECT `department_name` from `department` WHERE `department_id` = '" . $_SESSION["department_id"] . "'";
$dept = $db->Query($sql);
$dept = $db->fetch_array($dept);
$dept = array_shift($dept);
}
$applicant_sql = "SELECT count(*) FROM `personal_details` WHERE `progress`='Completed'";
$total_applicant = $db->query($applicant_sql);
$total_applicant = $db->fetch_array($total_applicant);
$total_applicant = array_shift($total_applicant);
function pd_get_total($column, $value)
{
global $db;
$query = "SELECT count(*) FROM `personal_details` WHERE `progress`='Completed' AND `" . $column . "`='" . $value . "'";
$total = $db->query($query);
$total = $db->fetch_array($total);
$total = array_shift($total);
return $total;
}
示例15: app_id_generator
function app_id_generator($dt_id, $applicant_id)
{
# Get the length of random number to generate
$random_number_length = 6 - strlen($applicant_id);
# Get the last delivery type code
$database = new MySQLDatabase();
$dtsql = $database->query("SELECT dt_code FROM delivery_type WHERE id='" . $dt_id . "'");
$result = $database->fetch_array($dtsql);
$dt_code = $result['dt_code'];
$random_number = rand(pow(10, $random_number_length - 1), pow(10, $random_number_length) - 1);
$dt = Carbon::now();
$carbon_year = $dt->format('Y');
$year = substr($carbon_year, 2, 2);
# Returns Delivery Type Code.Random Number.Year.Applicant Id
return $dt_code . $random_number . $year . $applicant_id;
}