-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsellingInsert.php
50 lines (45 loc) · 1.1 KB
/
sellingInsert.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
<!doctype html>
<html>
<head>
<meta charset="uft-8">
<title></title>
</head>
<body>
<?php
date_default_timezone_set("America/Los_Angeles");
$currentTime = date("Y-m-d H:i:s");
print ($currentTime);
?>
<?php
if ($_FILES["pic"]){
$pathname="images/" . $_FILES['pic']['name'];
move_uploaded_file($_FILES['pic']['tmp_name'], $pathname);
}
?>
<?php
include("Connect_Database.php")
?>
<?php
$selectUser = "SELECT * FROM users WHERE name ='"
. $_POST['name'] . "'AND email='"
. $_POST['email'] . "'";
$results = mysqli_query($connect, $selectUser);
$id = 0;
while($row = mysqli_fetch_assoc($results)) {
$id = $row["id"];
}
$bookInsert = "INSERT INTO books (seller_id, isbn10, title, author, price, description, post_time, pic_path)" .
" VALUES(" .
$id . ", " .
$_POST["isbn10"] . ", '" .
$_POST["title"] . "', '" .
$_POST["author"] . "', " .
$_POST["price"] . ", '" .
$_POST["description"] . "', '" .
$currentTime . "', '" .
$pathname . "')";
$result = mysqli_query($connect, $bookInsert);
header("Location: shopping.php")
?>
</body>
</html>