Ejemplo n.º 1
0
 public static function conn()
 {
     if (!self::$connection) {
         self::$connection = new DB_conn();
     }
     return self::$connection;
 }
Ejemplo n.º 2
0
 public function __construct()
 {
     global $dsn, $db_user, $db_pass, $driver, $db_prefix, $uid, $debug, $PATH, $smtp_username, $smtp_password;
     $this->dsn = $dsn;
     $this->driver = $driver;
     $this->db_prefix = $db_prefix;
     $this->uid = $uid;
     $this->PATH = $PATH;
     $this->smtp_username = $smtp_username;
     $this->smtp_password = $smtp_password;
     $parts = explode(":", $dsn);
     $this->pdo_driver = $parts[0];
     global $use_cookie;
     if ($use_cookie == 'false') {
         $this->use_cookie = false;
     } else {
         $this->use_cookie = $use_cookie;
     }
     global $usertable, $row_username, $row_userid, $avatar_field_name, $force_load_jquery;
     $this->usertable = $usertable;
     $this->row_username = $row_username;
     $this->row_userid = $row_userid;
     $this->avatar_field_name = $avatar_field_name;
     $this->force_load_jquery = $force_load_jquery;
     $this->time_string = strtotime(date("Y-m-d H:i:s"));
     $this->online_time = $this->time_string - 10;
     $this->online_time2 = $this->time_string - 80;
     global $custom_error_handling;
     $this->custom_error_handling = $custom_error_handling;
     $this->db = DB_conn::get_connection($dsn, $db_user, $db_pass);
     //$this->init_vars();
 }
Ejemplo n.º 3
0
 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>";
     }
 }
Ejemplo n.º 4
0
 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>";
 }
Ejemplo n.º 5
0
 private function databaseConnection()
 {
     if ($this->db_connection != null) {
         return true;
     } else {
         return $this->db_connection = DB_conn::conn();
     }
 }
Ejemplo n.º 6
0
 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['']){
     //
     //        }
 }
Ejemplo n.º 7
0
 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();
     }
 }
Ejemplo n.º 8
0
 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>";
 }
Ejemplo n.º 9
0
 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>';
 }
Ejemplo n.º 10
0
 public static function get_connection($dsn, $db_user, $db_pass)
 {
     if (self::$connected == true) {
         return self::$connection;
     }
     try {
         self::$connection = new PDO($dsn, $db_user, $db_pass, array(PDO::ATTR_PERSISTENT => false));
     } catch (PDOException $e) {
         self::freichat_debug("unable to connect to database. Error : " . $e->getMessage());
         die($e->getMessage());
     }
     self::freichat_debug("connected to database successfully");
     self::$connection->exec("SET CHARACTER SET utf8");
     self::$connection->exec("SET NAMES utf8");
     self::$connection->exec("SET SESSION sql_mode = 'ANSI';");
     self::$connected = true;
     return self::$connection;
 }
Ejemplo n.º 11
0
 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;
 }
Ejemplo n.º 12
0
 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>';
     }
 }
Ejemplo n.º 13
0
 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">
<?php

include_once 'dbMySqlCust.php';
$con = new DB_conn();
$table = "customer";
$res = $con->select($table);
?>



<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Car rental system</title>
    <link rel="stylesheet" href="style.css" type="text/css" />

</head>
<body>
<center>

    <div id="header">
        <div id="content">
            <label>Car Rental System</label>
        </div>
    </div>


    <div id="body">
        <div id="content">
            <table align="left">
                <tr>
 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;
 }
Ejemplo n.º 17
0
 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";
     }
 }
Ejemplo n.º 18
0
<!--
/**
 * 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">
Ejemplo n.º 19
0
 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";
     }
 }
Ejemplo n.º 20
0
 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;
 }
<?php

header('Content-type: text/json');
require_once "../../conn/db_conn.php";
echo '[';
$separator = "";
$i = 1;
echo $separator;
$initTime = date("Y") . "-" . date("m") . "-" . date("d") . " " . date("H") . ":00:00";
$conn = new DB_conn();
$query = $conn->prepare("SELECT * FROM event");
$query->execute();
while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
    $e_name = $row["Event_Name"];
    $e_date = $row["Date"];
    $e_time = $row["Time"];
    $e_descp = $row["Description"];
    $date = $e_date . " " . $e_time;
    $arr = array('date' => $date, 'type' => " ", 'title' => $e_name, 'description' => $e_descp, 'url' => "");
    echo json_encode($arr);
    echo ",";
}
echo '  { "date": "';
echo date("Y-m-d H:i:00");
echo '", "type": "", "title": " ';
echo '", "description": "", "url": "" }';
$separator = ",";
echo ']';