This repository has been archived by the owner on Nov 17, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsearch.php
51 lines (42 loc) · 1.45 KB
/
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
include_once 'head.php';
include_once 'login.php';
if (isset($_POST['search']))
{
$searchRequest = $_POST['search'];
}
else
{
include_once 'index.php';
die();
}
echo "<h2>Search Results</h2>";
echo "$searchRequest";
$nameResult = makeQuery("SELECT * FROM members WHERE doctorStatus = 'TRUE' AND (firstname = '$searchRequest' OR lastname = '$searchRequest')");
$docInfoResult = makeQuery("SELECT * FROM doctors WHERE specialty = '$searchRequest' OR hospital ='$searchRequest'");
$numNameRows = mysql_num_rows($nameResult);
$numInfoRows = mysql_num_rows($docInfoResult);
echo "<ul class='searchResults'>";
while($numNameRows > 0)
{
echo "I get here";
$nameRow = mysql_fetch_assoc($nameResult);
$userName = $nameRow['username'];
echo "<li class='doctorListing'>Dr. ".$nameRow['firstname']." ".$nameRow['lastname'].
" <a href = 'viewProfile?userToDisplay=$userName'>View Their Profile</a></li>";
--$numNameRows;
}
while($numInfoRows > 0)
{
$infoRow = mysql_fetch_assoc($docInfoResult);
$userName = $infoRow['username'];
$memberInfoResult = makeQuery("SELECT firstname, lastname FROM members WHERE username='$username'");
$membersInfoRow = mysql_fetch_assoc($memberInfoResult);
$firstname = $membersInfoRow['firstname'];
$lastname = $membersInfoRow['lastname'];
echo "<li class='doctorListing'>Dr. ".$firstname." ".$lastname.
" <a href = 'viewProfile?userToDisplay=$userName'>View Their Profile</a></li>";
--$numInfoRows;
}
include_once 'footer.php';
?>