-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathqueries.php
47 lines (28 loc) · 850 Bytes
/
queries.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
<?php
include 'connect.php';
function SentencesQuery($id) {
global $con;
$sql = "SELECT * FROM sentences WHERE criminal_ID = '" . mysqli_real_escape_string($con, $id) . "'";
$result = mysqli_query($con, $sql);
if (!$result) {
die('Error in SQL query: ' . mysqli_error($con));
}
$queryResult = mysqli_fetch_assoc($result);
if (!$queryResult) {
die('No data found for ID: ' . $id);
}
return $queryResult;
}
function criminalQuery($id) {
global $con;
if (empty($id)) {
$id = '101010';
}
$sql = "SELECT * FROM criminals WHERE criminal_ID = '" . mysqli_real_escape_string($con, $id) . "'";
$result = mysqli_query($con, $sql);
if (!$result) {
die('Error in SQL query: ' . mysqli_error($con));
}
return mysqli_fetch_assoc($result);
}
?>