示例#1
0
 function search()
 {
     include_once "faculty.php";
     $obj = new Faculty();
     $txt = $_REQUEST['txt'];
     if (!$obj->search($txt)) {
         echo '{"result":0, "message":"Searched Item does not exists"}';
         return;
     }
     $row = $obj->fetch();
     echo '{"result":1,"faculties":[';
     while ($row) {
         echo json_encode($row);
         $row = $obj->fetch();
         if ($row) {
             echo ",";
         }
     }
     echo "]}";
 }
示例#2
0
<?php

include "faculty.php";
$obj = new Faculty();
if (isset($_REQUEST['st'])) {
    $fa = $_REQUEST['st'];
    $str = "select * from FACULTY where Faculty_Name like '%{$fa}%' OR Faculty_Id='{$fa}'";
    $result = $obj->query($str);
    $row = $obj->fetch();
    echo "Suggestion: ";
    echo "<select>";
    while ($row) {
        echo "<option value=''>" . $row['Faculty_Name'] . "</option>";
        $row = $obj->fetch();
    }
    echo "</select>";
}