-
Notifications
You must be signed in to change notification settings - Fork 0
/
process-search.php
33 lines (27 loc) · 941 Bytes
/
process-search.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
<?php
session_start();
$base_url = 'http://' . $_SERVER['HTTP_HOST'] . '/Hacettepe-KDSE-BPYS';
if (isset($_SESSION['userlogin'])) {
}
require_once("config-students.php");
?>
<?php
if(isset($_GET)){
$nameOrEmail = $_GET['nameOrEmail'];
$sql = "SELECT id, name, surname, email FROM teachers WHERE email = '$nameOrEmail'";
$sql2 = "SELECT id, name, surname, email FROM students WHERE email = '$nameOrEmail'";
$smtmselect = $db->prepare($sql);
$smtmselect2 = $db->prepare($sql2);
$searchResults = $smtmselect->execute();
$searchResults2 = $smtmselect2->execute();
if($searchResults || $searchResults2){
$values1 = $smtmselect->fetchAll(PDO::FETCH_ASSOC);
$values2 = $smtmselect2->fetchAll(PDO::FETCH_ASSOC);
$allValues = array_merge($values1, $values2);
echo json_encode($allValues);
}
else {
echo "could not find anyone with those credentials";
}
}
?>