-
Notifications
You must be signed in to change notification settings - Fork 1
/
get_course_list.php
executable file
·38 lines (38 loc) · 1.14 KB
/
get_course_list.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
@session_start();
if($_SESSION['loged']=='true'){
require_once 'database.php';
$db= new database();
$db->open_connection();
$q = strtolower($_GET["q"]);
if (!$q) return;
//Students
$number=0;
$sql = "select Username, Name, Surname from users where Name LIKE '%$q%' or Surname LIKE '%$q%'";
$rsd = mysql_query($sql);
while($rs = mysql_fetch_array($rsd)) {
$number++;
$cname = $rs['Username']." '".$rs['Name']." ".$rs['Surname']."'";
echo "$cname\n";
}
//Universities
$sql = "select Username, Name_of_University, Name_of_Faculty from universitys where Name_of_University LIKE '%$q%' or Name_of_Faculty LIKE '%$q%'";
$rsd = mysql_query($sql);
while($rs = mysql_fetch_array($rsd)) {
$number++;
$cname = $rs['Username']." '".$rs['Name_of_University']." ".$rs['Name_of_Faculty']."'";
echo "$cname\n";
}
//Copmanies
$sql = "select Username, Name from companys where Name LIKE '%$q%' or Username LIKE '%$q%'";
$rsd = mysql_query($sql);
while($rs = mysql_fetch_array($rsd)) {
$number++;
$cname = $rs['Username']." '".$rs['Name']."'";
echo "$cname\n";
}
if($number==0){
echo "There is no user with typed letters\n";
}
}
?>