forked from rexali/one-farm-ecommerce
-
Notifications
You must be signed in to change notification settings - Fork 0
/
order.php
60 lines (39 loc) · 1.03 KB
/
order.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
52
53
54
55
56
57
58
59
60
<?php
header("Content-Type: application/json; charset=UTF-8");
$ob = json_decode($_GET["x"], false);
/* Attempt MySQL server connection. Assuming you are running MySQL
server with default setting (user 'root' with no password) */
$link = mysqli_connect("localhost", "root", "", "farmer");
// Check connection
if($link === false){
die("ERROR: Could not connect. " . mysqli_connect_error());
}
//$ob->pImage=basename($ob->pImage);
class Jsn
{
public $result='result';
}
$j = new Jsn();
$output = array();
$outpt = array();
$output = array($j->result=> 'Saved successfully');
$outpt = array($j->result=> 'Failed to save');
// Attempt insert query execution
$sql = "INSERT INTO orders
(
pid,
cEmail
)
VALUES
(
'$ob->pid',
'$ob->cEmail'
)";
if(mysqli_query($link, $sql)){
echo 'thankYou('.json_encode($output).')' ;
} else{
echo json_encode($outpt); //"ERROR: Could not able to execute $sql. " . mysqli_error($link);
}
// Close connection
mysqli_close($link);
?>