public function test($cors) { $this->dbConnection = DB_conn::conn(); $data1 = $this->dbConnection->prepare("SELECT * FROM subject WHERE Course_Course_ID = '{$cors}'"); $data1->execute(); $row1 = $data1->fetchAll(); $username = $_SESSION['user_name']; if ($row1 != null) { echo "<table class='table1'>"; echo "<tr class='row2'>"; echo "<th class='row_label'> Subject ID </th>"; echo "<th class='row_label'> Mark </th>"; echo "</tr>"; foreach ($row1 as $d) { $subid = $d[0]; $data2 = $this->dbConnection->prepare("SELECT * FROM marks WHERE Sub_ID = '{$subid}' AND Student_ID = '{$username}'"); $data2->execute(); foreach ($data2 as $d1) { echo "<tr class='row1'>"; echo "<th class='row_label'> {$d1['1']} </th>"; echo "<th class='row_label'> {$d1['3']}</th>"; echo "</tr>"; } } } else { echo '<p style="color:#e40005; margin-left: 20px; text-align:center; font-family: Century Gothic; font-size:22px;background-color: #ffebe8;padding: 25px;margin: 25px; border-style: solid; border-color:#dd3c10 ">No data</p>'; } $link = "myFunction1('/ACTA_project/view/student/stu_home.php')"; echo "<table class='table1'>\n <tr >\n <td><button class='button1' onclick=" . $link . ">Back </button></td>\n <td></td>\n </tr>\n </table>"; }
public function payStatement($query) { //pay statement $this->dbConnection = DB_conn::conn(); $data = $this->dbConnection->prepare($query); $data->execute(); $row = $data->fetch(); if (empty($row)) { echo "<div class='panel_body'>\n <div class='panel_bar'><p>New Balance</p>\n </div>\n <div class='panel_body_cont'>"; echo "no payment"; echo "</div></div></div>"; } else { echo "<div class='panel_body'>\n <div class='panel_bar'><p>Pay Statement</p>\n </div>\n <div class='panel_body_cont'>"; echo "<table class='table1'>"; echo "<tr class='row2'>"; echo "<th class='row_label'> Course </th>"; echo "<th class='row_label'> Paid Date </th>"; echo "<th class='row_label'> Paid Amount </th>"; echo "</tr>"; echo "<tr class='row1'>"; echo "<td class='row_label'>{$row['1']}</td>"; echo "<td class='row_label'>{$row['2']}</td>"; echo "<td class='row_label'>{$row['3']}</td>"; echo "</tr>"; echo "</table></div></div></div>"; } }
private function databaseConnection() { if ($this->db_connection != null) { return true; } else { return $this->db_connection = DB_conn::conn(); } }
public function __construct() { $conn = DB_conn::conn(); if ($_POST['search']) { $categ = $_POST['person']; $q = $_POST['search']; $person_cate = null; $person_ID = null; $person_ID1 = null; if ($categ == "student") { $person_cate = "student"; $person_ID = "Student_ID"; $person_ID1 = "DQS"; } elseif ($categ = "academic") { $person_cate = "aca_staff"; $person_ID = "Ac_ID"; $person_ID1 = "ac"; } //or is_numeric($q) if ($q == $person_ID1) { $qry = $conn->prepare("SELECT * FROM {$person_cate} INNER JOIN person ON {$person_cate}.Person_NIC = person.NIC WHERE {$person_cate}.{$person_ID} LIKE '%{$q}%' order by {$person_cate}.{$person_ID} LIMIT 10"); $qry->execute(); echo "<table class='table1'>"; while ($row = $qry->fetch(PDO::FETCH_ASSOC)) { $name = $row['FirstName']; $last = $row['LastName']; $id = $row[$person_ID]; // $name2="<strong>".$q."</strong>"; // $name3 = str_ireplace($q, $name2, $name); $ful_name = $id . " - " . $name . " " . $last; echo "<tr class='row1'>"; echo "<td class='row_label2' ></td>"; echo "<td class='input_data'><input class='show' type='text' name='c_ID' id='c_ID' value='" . $ful_name . "' readonly='readonly' ></td>"; echo "</tr>"; } echo "</table>"; } else { $qry = $conn->prepare("SELECT * FROM person INNER JOIN {$person_cate} ON person.NIC = {$person_cate}.Person_NIC WHERE person.FirstName LIKE '%{$q}%' OR person.LastName LIKE '%{$q}%' order by person.FirstName LIMIT 10"); $qry->execute(); echo "<table class='table1'>"; while ($row = $qry->fetch(PDO::FETCH_ASSOC)) { $name = $row['FirstName']; $last = $row['LastName']; $id = $row[$person_ID]; $ful_name = $id . " - " . $name . " " . $last; echo "<tr class='row1'>"; echo "<td class='row_label2' ></td>"; echo "<td class='input_data'><input class='show' type='text' name='c_ID' id='c_ID' value='" . $ful_name . "'onclick='autoCompl_get();' ></td>"; echo "</tr>"; } echo "</table>"; } } // elseif($_POST['']){ // // } }
private function databseConnection() { //check the database connection if ($this->db_connection != null) { return true; } else { //if not connect, create ca new connection return $this->db_connection = DB_conn::conn(); } }
public function getCourse($query, $course) { //get course details $this->dbConnection = DB_conn::conn(); $data = $this->dbConnection->prepare($query); $data->execute(); $row = $data->fetchAll(); if (empty($row)) { echo "<div class='panel' id='panel'>\n <div class='panel_bar' >\n <p>{$course} </p>\n </div>"; echo "no subjects"; } else { $data1 = $this->dbConnection->prepare("SELECT * FROM course WHERE Course_ID = '{$course}'"); $data1->execute(); $row1 = $data1->fetch(); $co = $row1['Name']; echo "<div class='panel' id='panel'>\n <div class='panel_bar' >\n <p>{$co}</p>\n </div>"; echo "<table class='table1'>"; echo "<tr class='row2'>"; echo "<th class='row_label'> Subject Id </th>"; echo "<th class='row_label'> Subject Name </th>"; echo "<th class='row_label'> Credits </th>"; echo "<th class='row_label'> Description </th>"; echo "<th class='row_label'> Lecturer Name </th>"; /* changed*/ echo "</tr>"; foreach ($row as $d) { echo "<tr class='row1'>"; echo "<td class='row_label'>{$d['Sub_ID']}</td>"; //subject ID echo "<td class='row_label'>{$d['Sub_Name']}</td>"; //Subject Name echo "<td class='row_label'>{$d['Sub_credit']}</td>"; //Description echo "<td class='row_label'>{$d['discription']}</td>"; //Description $acc = $d['Aca_Staff_Ac_ID']; $data2 = $this->dbConnection->prepare("SELECT * FROM aca_staff WHERE Ac_ID = '{$acc}'"); $data2->execute(); $row2 = $data2->fetch(); $co1 = $row2['Person_NIC']; $data3 = $this->dbConnection->prepare("SELECT * FROM person WHERE NIC = '{$co1}'"); $data3->execute(); $row3 = $data3->fetch(); $co2 = $row3['Title']; $co4 = $row3['LastName']; $name = $co2 . "." . $co4; echo "<td class='row_label'>{$name}</td>"; echo "</tr>"; } echo "</table>"; } $link = "myFunction1('/ACTA_project/view/student/stu_course.php')"; echo "<table class='table1'>\n <tr >\n <td><button class='button1' onclick=" . $link . ">Back </button></td>\n <td></td>\n </tr>\n </table>"; }
public function setData($str, $cit, $pos, $eml, $pno, $mno, $cname, $caddr, $cno) { $this->dbConnection = DB_conn::conn(); $username = $_SESSION['user_name']; $data2 = $this->dbConnection->prepare("SELECT * FROM authen WHERE user_name = '{$username}'"); $data2->execute(); $row2 = $data2->fetch(); $need1 = $row2["Person_NIC"]; $query1 = $this->dbConnection->prepare("UPDATE person SET Street = '{$str}', City = '{$cit}',PostalCode = '{$pos}',Email = '{$eml}',PhoneNo = '{$pno}',MobileNo = '{$mno}' WHERE NIC = '{$need1}'"); $query1->execute(); $query2 = $this->dbConnection->prepare("UPDATE student SET Company = '{$cname}', Office_address = '{$caddr}',Office_TelNo = '{$cno}' WHERE Person_NIC = '{$need1}'"); $query2->execute(); echo '<p style="color:#e40005; margin-left: 20px; text-align:center; font-family: Century Gothic; font-size:22px;background-color: #ffebe8;padding: 25px;margin: 25px; border-style: solid; border-color:#dd3c10 ">Update Successful!!</p>'; }
private function getNIC($id) { $conn = DB_conn::conn(); $users = array('student', 'aca_staff', 'admin_staff', 'parent'); $userids = array('Student_ID', 'Ac_ID', 'Ad_ID', 'Student_ID'); $nic = null; for ($i = 0; $i < 4; $i++) { $username = $users[$i]; $userid = $userids[$i]; $qry = $conn->prepare("SELECT * FROM person INNER JOIN {$username} ON person.NIC = {$username}.Person_NIC WHERE {$username}.{$userid}='{$id}'"); $qry->execute(); $row = $qry->fetch(PDO::FETCH_ASSOC); if ($row['NIC'] != null) { $nic = $row['NIC']; break; } } return $nic; }
public function getMark() { session_start(); $username = $_SESSION['user_name']; $this->dbConnection = DB_conn::conn(); $data1 = $this->dbConnection->prepare("SELECT * FROM student WHERE Student_ID = '{$username}'"); $data1->execute(); $row1 = $data1->fetch(); $course = $row1['Course_Course_ID']; $data2 = $this->dbConnection->prepare("SELECT * FROM subject WHERE Course_Course_ID = '{$course}'"); $data2->execute(); $row2 = $data2->fetchAll(); if ($row2 != null) { echo "<div class='panel_body'>\n <div class='panel_bar'><p>All Marks</p>\n </div>\n <div class='panel_body_cont'>"; echo "<table class='table1'>"; echo "<tr class='row2'>"; echo "<th class='row_label'> Subject ID </th>"; echo "<th class='row_label'> Subject Name </th>"; echo "<th class='row_label'> Mark </th>"; echo "</tr>"; foreach ($row2 as $d) { $subid = $d[0]; $data2 = $this->dbConnection->prepare("SELECT * FROM marks WHERE Sub_ID = '{$subid}' AND Student_ID = '{$username}'"); $data2->execute(); foreach ($data2 as $d1) { echo "<tr class='row1'>"; echo "<th class='row_label'> {$d1['Sub_ID']} </th>"; $sub = $d['Sub_ID']; $data3 = $this->dbConnection->prepare("SELECT * FROM subject WHERE Sub_ID = '{$sub}'"); $data3->execute(); $row2 = $data3->fetch(); echo "<th class='row_label'> {$row2['1']}</th>"; echo "<th class='row_label'> {$d1['3']}</th>"; echo "</tr>"; } } echo "</table></div></div>"; } else { echo '<p style="color:#e40005; margin-left: 20px; text-align:center; font-family: Century Gothic; font-size:22px;background-color: #ffebe8;padding: 25px;margin: 25px; border-style: solid; border-color:#dd3c10 ">No data</p>'; } }
public function getCourse($query, $course) { //get course details $this->dbConnection = DB_conn::conn(); $data = $this->dbConnection->prepare($query); $data->execute(); $row = $data->fetchAll(); if (empty($row)) { echo "<div class='panel' id='panel'>\n <div class='panel_bar' >\n <p>Course Details </p>\n </div>"; echo "No subjects"; } else { echo "<div class='panel' id='panel'>\n <div class='panel_bar' >\n <p>Course Details </p>\n </div>"; echo "<table class='table1'>"; echo "<tr class='row2'>"; echo "<th class='row_label'> Subject ID </th>"; echo "<th class='row_label'> Subject Name </th>"; echo "<th class='row_label'> Credits </th>"; echo "<th class='row_label'> Description </th>"; echo "<th class='row_label'> Course ID</th>"; echo "</tr>"; foreach ($row as $d) { echo "<tr class='row1'>"; echo "<td class='row_label'>{$d['0']}</td>"; //subject ID echo "<td class='row_label'>{$d['1']}</td>"; //Subject Name echo "<td class='row_label'>{$d['2']}</td>"; //Description echo "<td class='row_label'>{$d['3']}</td>"; echo "<td class='row_label'>{$d['4']}</td>"; //Assigned lecturer echo "</tr>"; } echo "</table>"; } }
* Date: 1/19/15 * Time: 1:49 PM */ ?> <div class="panel_upper"> <div class="p0"> <label class="p1"> Course ></label> <label class="p2"> Course Details</label> </div> </div> <?php require_once "../../conn/db_conn.php"; $conn = DB_conn::conn(); $c_id = null; if ($_POST['search']) { global $c_id; $c_id = $_POST['search']; $query = $conn->prepare("SELECT * FROM course WHERE Course_ID= '{$c_id}'"); $query->execute(); $row = $query->fetch(PDO::FETCH_ASSOC); $c_name = $row['Name']; $c_details = $row['Details']; $c_levels = $row['No_of_Levels']; $c_dur = $row['Duration']; ?> <div class="panel"> <div class="panel_body">
public function calcAtten($stu_id, $stu_atten) { $len = count($stu_atten); // echo "/////////"; // echo $len; $s_att = 0; $hold_date = 0; for ($x = 0; $x < $len; $x++) { $s_att = $s_att + $stu_atten[$x][0]; $hold_date = $hold_date + $stu_atten[$x][1]; $this->details[$x][1] = $stu_atten[$x][0]; $this->details[$x][2] = $stu_atten[$x][1]; } if ($hold_date != 0) { // echo "(".$hold_date.")"; $att_percentage = round($s_att / $hold_date * 100, 0); if ($att_percentage < 80) { $att_percentage = $att_percentage . " *"; } $this->no_of_dates_participated = $s_att; $this->no_of_dates_held = $hold_date; $count = $this->s_count; $this->students_atten_percentage[$count][0] = $stu_id; $this->students_atten_percentage[$count][1] = $att_percentage; $this->s_count = $count + 1; $this->db_connection = DB_conn::conn(); $query2 = $this->db_connection->prepare("SELECT * FROM student WHERE student_ID = '{$stu_id}'"); $query2->execute(); $row11 = $query2->fetch(); $nic = $row11['Person_NIC']; $query3 = $this->db_connection->prepare("SELECT * FROM person WHERE NIC = '{$nic}'"); $query3->execute(); $row12 = $query3->fetch(); $name1 = $row12['Title']; $name2 = $row12['FirstName']; $name3 = $row12['LastName']; $name = $name1 . "." . $name2 . " " . $name3; $data = array($stu_id, $name, $hold_date, $s_att, $this->students_atten_percentage[0][1]); $this->atten_details = $data; return true; } return false; }
public function query($query, $want) { $dbconnection = DB_conn::conn(); $data = $dbconnection->prepare($query); $data->execute(); $row = $data->fetch(); $need = $row[$want]; #person nic of authen table //$_SESSION["NIC"] = $need; if ($need != null) { $data2 = $dbconnection->prepare("SELECT * FROM person WHERE NIC = '{$need}'"); $data2->execute(); $row2 = $data2->fetch(); $need2 = $row2["NIC"]; #NIC of student from person table $t = $row2["Title"]; $f = $row2["FirstName"]; $l = $row2["LastName"]; $s = $row2["Street"]; $c = $row2["City"]; $p = $row2["PostalCode"]; $e = $row2["Email"]; $pn = $row2["PhoneNo"]; $mn = $row2["MobileNo"]; $un = $_SESSION["user_name"]; if ($need2 != null) { $data3 = $dbconnection->prepare("SELECT * FROM aca_staff WHERE Person_NIC = '{$need}'"); $data3->execute(); $row3 = $data3->fetch(); $need3 = $row3["Person_NIC"]; $desg = $row3["Designation"]; $endate = $row3["Enroll_Date"]; echo "<table class='table1'>"; echo "<tr class='row1'>"; echo "<td class='row_label'> Acadamic Staff ID </td>"; echo "<td class='input_data'><input class='input data' type='text' value= {$un} readonly='readonly'></td>"; echo "</tr>"; echo "<tr class='row1'>"; echo "<td class='row_label'> NIC </td>"; echo "<td class='input_data'><input class='input data' type='text' value= {$need2} readonly='readonly'></td>"; echo "</tr>"; echo "<tr class='row1'>"; echo "<td class='row_label'> Title </td>"; echo "<td class='input_data'><input class='input data' type='text' value= {$t} readonly='readonly'></td>"; echo "</tr>"; echo "<tr class='row1'>"; echo "<td class='row_label'> First Name </td>"; echo "<td class='input_data'><input class='input data' type='text' value= {$f} readonly='readonly'></td>"; echo "</tr>"; echo "<tr class='row1'>"; echo "<td class='row_label'> Last Name </td>"; echo "<td class='input_data'><input class='input data' type='text' value= {$l} readonly='readonly'></td>"; echo "</tr>"; echo "<tr class='row1'>"; echo "<td class='row_label'> Street </td>"; echo "<td class='input_data'><input class='input data' type='text' value= {$s} readonly='readonly'></td>"; echo "</tr>"; echo "<tr class='row1'>"; echo "<td class='row_label'> City </td>"; echo "<td class='input_data'><input class='input data' type='text' value= {$c} readonly='readonly'></td>"; echo "</tr>"; echo "<tr class='row1'>"; echo "<td class='row_label'> Postal Code </td>"; echo "<td class='input_data'><input class='input data' type='text' value={$p} readonly='readonly'></td>"; echo "</tr>"; echo "<tr class='row1'>"; echo "<td class='row_label'> Email </td>"; echo "<td class='input_data'><input class='input data' type='text' value= {$e} readonly='readonly'></td>"; echo "</tr>"; echo "<tr class='row1'>"; echo "<td class='row_label'> Phone No </td>"; echo "<td class='input_data'><input class='input data' type='text' value= {$pn} readonly='readonly'></td>"; echo "</tr>"; echo "<tr class='row1'>"; echo "<td class='row_label'> Mobile No </td>"; echo "<td class='input_data'><input class='input data' type='text' value= {$mn} readonly='readonly'></td>"; echo "</tr>"; echo "<tr class='row1'>"; echo "<td class='row_label'> Designation </td>"; echo "<td class='input_data'><input class='input data' type='text' value= {$desg} readonly='readonly'></td>"; echo "</tr>"; echo "<tr class='row1'>"; echo "<td class='row_label'> Enroll Date </td>"; echo "<td class='input_data'><input class='input data' type='text' value= {$endate} readonly='readonly'></td>"; echo "</tr>"; echo "</table>"; } else { echo "No Lecturer record"; } } else { echo "No Lecturer record"; } }
<!-- /** * Created by PhpStorm. * User: Rushan Gajanayake * Date: 9/15/14 * Time: 6:39 PM */ --> <?php require_once "../../conn/db_conn.php"; session_start(); $nic = $_SESSION['p_nic']; $db = DB_conn::conn(); $quary = $db->prepare('SELECT * FROM admin_staff WHERE Person_NIC=:u_nic'); $quary->bindValue(':u_nic', $nic, PDO::PARAM_STR); $quary->execute(); $data = $quary->fetchObject(); $p_id = $data->Ad_ID; ?> <html> <div class="panel_upper"> <div class="p0"> <label class="p1"> Course ></label> <label class="p2"> Add Course</label> </div> </div> <div class="panel"> <div class="panel_body">
private function databaseConnection() { if ($this->db_connection != null) { return true; } else { // try{ // // $this->db_connection = new PDO('mysql:host='.DB_host.';dbname='.DB_name.';charset=utf8',DB_user,DB_pass); // return true; // } // catch(PDOException $e){ // // } //$db = new DB_conn(); return $this->db_connection = DB_conn::conn(); } //return false; }
public function query($query, $want) { $dbconnection = DB_conn::conn(); $data = $dbconnection->prepare($query); $data->execute(); $row = $data->fetch(); $need = $row[$want]; #person nic of authen table //$_SESSION["NIC"] = $need; if ($need != null) { $data2 = $dbconnection->prepare("SELECT * FROM person WHERE NIC = '{$need}'"); $data2->execute(); $row2 = $data2->fetch(); $need2 = $row2["NIC"]; #NIC of student from person table $t = $row2["Title"]; $f = $row2["FirstName"]; $l = $row2["LastName"]; $s = $row2["Street"]; $c = $row2["City"]; $p = $row2["PostalCode"]; $e = $row2["Email"]; $pn = $row2["PhoneNo"]; $mn = $row2["MobileNo"]; $un = $_SESSION["user_name"]; if ($need2 != null) { $data3 = $dbconnection->prepare("SELECT * FROM student WHERE Person_NIC = '{$need}'"); $data3->execute(); $row3 = $data3->fetch(); $need3 = $row3["Person_NIC"]; $rg = $row3["Reg_Date"]; $cid = $row3["Course_Course_ID"]; $cn = $row3["Company"]; $cno = $row3["Office_TelNo"]; $ca = $row3["Office_address"]; echo "<div class='panel_body'>\n <div class='panel_bar'><p></p>\n </div>\n <div class='panel_body_cont'>"; echo "<table class='table1'>"; echo "<tr class='row1'>"; echo "<td class='row_label'> Student ID </td>"; echo "<td class='input_data'><input class='input data' type='text' value= {$un} readonly='readonly'></td>"; echo "</tr>"; echo "<tr class='row1'>"; echo "<td class='row_label'> NIC </td>"; echo "<td class='input_data'><input class='input data' type='text' value= {$need2} readonly='readonly'></td>"; echo "</tr>"; echo "<tr class='row1'>"; echo "<td class='row_label'> Title </td>"; echo "<td class='input_data'><input class='input data' type='text' value= {$t} readonly='readonly'></td>"; echo "</tr>"; echo "<tr class='row1'>"; echo "<td class='row_label'> First Name </td>"; echo "<td class='input_data'><input class='input data' type='text' value= {$f} readonly='readonly'></td>"; echo "</tr>"; echo "<tr class='row1'>"; echo "<td class='row_label'> Last Name </td>"; echo "<td class='input_data'><input class='input data' type='text' value= {$l} readonly='readonly'></td>"; echo "</tr>"; echo "<tr class='row1'>"; echo "<td class='row_label'> Registered Date </td>"; echo "<td class='input_data'><input class='input data' type='text' value= {$rg} readonly='readonly'></td>"; echo "</tr>"; echo "<tr class='row1'>"; echo "<td class='row_label'> Course </td>"; echo "<td class='input_data'><input class='input data' type='text' value= {$cid} readonly='readonly'></td>"; echo "</tr>"; echo "<tr class='row1'>"; echo "<td class='row_label'> Street </td>"; echo "<td class='input_data'><input class='input data' type='text' value= {$s} readonly='readonly'></td>"; echo "</tr>"; echo "<tr class='row1'>"; echo "<td class='row_label'> City </td>"; echo "<td class='input_data'><input class='input data' type='text' value= {$c} readonly='readonly'></td>"; echo "</tr>"; echo "<tr class='row1'>"; echo "<td class='row_label'> Postal Code </td>"; echo "<td class='input_data'><input class='input data' type='text' value={$p} readonly='readonly'></td>"; echo "</tr>"; echo "<tr class='row1'>"; echo "<td class='row_label'> Email </td>"; echo "<td class='input_data'><input class='input data' type='text' value= {$e} readonly='readonly'></td>"; echo "</tr>"; echo "<tr class='row1'>"; echo "<td class='row_label'> Phone No </td>"; echo "<td class='input_data'><input class='input data' type='text' value= {$pn} readonly='readonly'></td>"; echo "</tr>"; echo "<tr class='row1'>"; echo "<td class='row_label'> Mobile No </td>"; echo "<td class='input_data'><input class='input data' type='text' value= {$mn} readonly='readonly'></td>"; echo "</tr>"; echo "<tr class='row1'>"; echo "<td class='row_label'> Company Name </td>"; echo "<td class='input_data'><input class='input data' type='text' value= '{$cn}' readonly='readonly'></td>"; echo "</tr>"; echo "<tr class='row1'>"; echo "<td class='row_label'> Office Address </td>"; echo "<td class='input_data'><input class='input data' type='text' value= '{$cno}' readonly='readonly'></td>"; echo "</tr>"; echo "<tr class='row1'>"; echo "<td class='row_label'> Office Phone No </td>"; echo "<td class='input_data'><input class='input data' type='text' value='{$ca}' readonly='readonly'></td>"; echo "</tr>"; echo "</table></div></div></div>"; } else { echo "no student record"; } } else { echo "no student record"; } }