-
Notifications
You must be signed in to change notification settings - Fork 1
/
getcomps.php
21 lines (18 loc) · 799 Bytes
/
getcomps.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
include_once "../config.php";
if ($cc=filter_input(INPUT_GET, "c", FILTER_SANITIZE_STRING) ) {
$stmt=$conn->prepare("SELECT parentComp from comps where compLetters = ?");
$stmt->bind_param("s",$cc);
$stmt->execute();
$result = $stmt->get_result()->fetch_assoc();
$stmt=$conn->prepare("SELECT compName,compLetters from comps where parentComp=? AND enddate >= curdate() AND NOT compLetters=?");
$stmt->bind_param("ss",$result["parentComp"],$result["parentComp"]);
} else {
$stmt=$conn->prepare("SELECT isChild,parentComp,isParent, compName, compLetters from comps WHERE enddate >= curdate()");
}
$stmt->execute();
$result = $stmt->get_result();
while ($row = $result->fetch_assoc()) {
echo $row["compName"].",". $row["compLetters"].",";
}
$conn->close(); ?>