-
Notifications
You must be signed in to change notification settings - Fork 0
/
zamowieniePOST.php
33 lines (30 loc) · 1.17 KB
/
zamowieniePOST.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
<?php
session_start();
$conn = oci_connect('student', 'student', 'localhost:1521/kosmos');
if (!$conn) {
$m = oci_error();
trigger_error(htmlentities($m['message']), E_USER_ERROR);
}
$ktolog = $_SESSION['email'];
$didbv= $ktolog;
$sql = 'SELECT * FROM koszyk WHERE koszyk_id = :didbv ';
$stid = oci_parse($conn, $sql);
oci_bind_by_name($stid, ':didbv', $didbv);
oci_execute($stid);
while (($row = oci_fetch_array($stid, OCI_ASSOC)) != false) {
$klient_id = $row['klient_id'];
$pracownik_id = $row['pracownik_id'];
$wartosc = $row['wartosc'];
$produkty_inside = $row['produkty_inside'];
}
if (!isset($_SESSION["zlozzamowienie"])) {
$_SESSION['bladzam'] = '<span class="text=centre" style="color:red">Wystąpił błąd przy składaniu zamówienia</span>';
header('Location: koszyk.php');
exit();
} else {
$stid = oci_parse($conn, "begin create_zam(:klient_id, :pracownik_id, :wartosc, :produkty_inside); end;");
oci_bind_by_name($stid, ":klient_id", $klient_id);
oci_bind_by_name($stid, ":pracownik_id", $pracownik_id);
oci_bind_by_name($stid, ":wartosc", $wartosc);
oci_bind_by_name($stid, ":produkty_inside", $produkty_inside);
}