-
Notifications
You must be signed in to change notification settings - Fork 10
/
newOrder.php
42 lines (32 loc) · 855 Bytes
/
newOrder.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
// Connect to the database server
$error = '';
$success = '';
if (isset($_POST['record']) and is_numeric($_POST['record'])) {
$dbcnx = mysqli_connect("localhost", "root", "", "compsys");
if (mysqli_connect_errno($dbcnx ))
{
$error = "Failed to connect to MySQL: " .mysqli_connect_error();
exit();
}
$repair = $_POST['record'];
$sql = "SELECT * FROM repairs WHERE rep_id = $repair";
$res = mysqli_query($dbcnx, $sql);
if ( !$res ) {
$error = ('Query failed ' . $sql . ' Error:' . mysqli_error($dbcnx));
exit();
}
else
{
$row = mysqli_fetch_array($res);
$repair = $row['Rep_ID'];
if ($row < 1) {
header("refresh:1; url=chooseRepair.php");
} //if nothing is found
}
//free results
mysqli_free_result($res);
//close connection
mysqli_close($dbcnx);
}
?>