function get_request_by_id($id) { $db = new adb(); $db->connect(); $result = "SELECT * FROM gnpc_lms.lms_requests\n \t\tINNER JOIN gnpc_employees.ge_users ON (ge_users.u_id=lms_requests.employee_ref)\n \t\tINNER JOIN lms_leave_type ON (lms_leave_type.t_id=lms_requests.leave_type_ref)\n \t\tINNER JOIN lms_request_status ON (lms_request_status.rs_id=lms_requests.request_status_ref)\n \t\tWHERE r_id='{$id}'"; if (!$db->query($result)) { return false; } return $db->fetch(); }
function get_request_by_id($id) { $db = new adb(); $db->connect(); $result = "SELECT he_id, he_device_model, he_serial_no, ghi_hardware_type.ht_id, ghi_hardware_type.hardware_name,\n \t\tdevice_name, supplier_name, repairer_name, he_warranty_exdate, ghi_status.s_id, ghi_status.status, ghi_repairs.r_id, ghi_repairs.repair_status,\n \t\trepair_comments, DATE_FORMAT(start_repair_date, '%d %b %Y') as start_repair_date, DATE_FORMAT(end_repair_date, '%d %b %Y') as end_repair_date, \n \t\tDATE_FORMAT(date_registered, '%d %b %Y') as date_registered, date_of_manufacture, he_user_name,\n \t\tghi_departments.d_id, ghi_departments.dep_name, DATE_FORMAT(start_dispatch_date, '%d %b %Y') as start_dispatch_date, DATE_FORMAT(end_dispatch_date, '%d %b %Y') as end_dispatch_date\n \t\tFROM ghi_hardware_entry\n \t\tINNER JOIN ghi_hardware_type ON (ghi_hardware_type.ht_id=ghi_hardware_entry.he_type)\n \t\tINNER JOIN ghi_status ON (ghi_status.s_id=ghi_hardware_entry.he_status)\n \t\tINNER JOIN ghi_repairs ON (ghi_repairs.r_id=ghi_hardware_entry.he_repair_status)\n \t\tINNER JOIN ghi_departments ON (ghi_departments.d_id=ghi_hardware_entry.he_dep_ref)\n \t\tWHERE he_id='{$id}'"; if (!$db->query($result)) { return false; } return $db->fetch(); }
function authenticateUser() { include "adb.php"; $user_email = $_REQUEST['usermail']; $user_pass = $_REQUEST['userpass']; $obj = new adb(); $sql_users = "select * from users where email='{$user_email}'\n\tand password='******'"; if ($obj->query($sql_users)) { $dataset = $obj->fetch(); if (empty($dataset['email']) or empty($dataset['password'])) { echo '{"result":2}'; } else { echo '{"result":1}'; } } }
/** * Bring up events data */ function getEvents() { include_once "adb.php"; $eqp = new adb(); $str_query = "select * from inven_products"; if (!$eqp->query($str_query)) { echo '{"result": 0, "message": "No Events in database"}'; return; } $data = array(); $row = $eqp->fetch(); while ($row) { $row_array['id'] = $row['id']; $row_array['owner'] = $row['product_id']; $row_array['name'] = $row['products']; $row_array['des'] = $row['quantity']; $row_array['contact'] = $row['price']; $row = $eqp->fetch(); // //push the values in the array array_push($data, $row_array); } echo json_encode($data); }
include 'adb.php'; $obj = new adb(); $obj->connect(); $select_query = "Select * from task,nurse where task.nurse_id = nurse.nurse_id"; $obj->query($select_query); echo "<table border='1' id='tableExample' class='reportTable' width='100%'>"; echo "<tr style = 'Background-color:#066d5d' class='header'>"; echo "<td>Task id</td>"; echo "<td>Task name</td>"; echo "<td>Due date</td>"; echo "<td>Description</td>"; echo "<td>Nurse</td>"; echo "<td></td>"; echo "<td></td>"; echo "</tr>"; $row = $obj->fetch(); while ($row) { echo "<tr>"; echo "<td width=7% >" . $row['task_id'] . "</td>"; echo "<td>" . $row['task_name'] . "</td>"; echo "<td td width=10%>" . $row['due_date'] . "</td>"; echo "<td>" . $row['description'] . "</td>"; echo "<td >" . $row['nurse_name'] . "</td>"; echo "<td width=5% style='text-align:center;font-weight: bold'><a href=''style='text-decoration:none;color:#066d5d'>log</a></td>"; echo "<td width=8% style = 'text-align:center;font-weight: bold'><a href=''style='text-decoration:none;color:#066d5d'>End task</a></td>"; echo "</tr>"; $row = $obj->fetch(); } echo "</table>"; ?>