-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshowdetails.php
79 lines (61 loc) · 2.35 KB
/
showdetails.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>Zamówienia</title>
<!--[if !IE]><!-->
<link rel="stylesheet" href="/css/main.css" />
<!--<![endif]-->
<!--[if gte IE 7]>
<link rel="stylesheet" type="text/css" href="/css/main.css" media="screen, projection" />
<![endif]-->
<!--[if IE 6]>
<link rel="stylesheet" type="text/css" href="http://universal-ie6-css.googlecode.com/files/ie6.0.3.css" media="screen, projection" />
<![endif]-->
</head>
<body>
<?php
$table = read_data_from_database();
function read_data_from_database(){
$incr = 0;
$sum = 0;
require('serverconf.php');
$link = mysqli_connect($adresserwera, $nazwauzyt, $haslo, $nazwabd);
$forordkey=$_POST['forordkey'];
//echo $forordkey;
$zapytanie = "SELECT * FROM `product` WHERE product_forordkey='".$forordkey."'";
$wynik_zapytania = mysqli_query($link, $zapytanie);
echo mysqli_connect_error();
echo "<center><form action='saveprices.php' method='POST'><table>";
echo "<tr><th>Nazwa</th><th>Ilość</th><th>Cena</th></tr>";
while($row=mysqli_fetch_array($wynik_zapytania,MYSQLI_ASSOC)){
echo "<tr><td>".$row["product_pname"]."</td><td>".$row["product_quantity"]."</td><td>
<input name='productprice".$row["product_id"]."' value=".$row["product_price"].">
<input type='hidden' name='productid".$incr."' value=".$row["product_id"].">
<input type='hidden' name='quantity".$row["product_id"]."' value=".$row["product_quantity"]."></td></tr>";
echo "\n";
$sum = $sum + ($row["product_price"]*$row["product_quantity"]);
$incr++;
}
echo "<input type='hidden' value='".$forordkey."' name='forordkey'>";
echo "<tr><td></td><td></td><td><h3>Łączny koszt <br>zamówienia: ".$sum." </h3></td></tr>";
echo "<tr><td><input type='submit' value='Zapisz ceny'></form></td>
<td><a href='read.php'>Powrót do listy</a></td>
<td><form action='delete.php' method='POST'>
<input type='hidden' name='forordkey' value='".$forordkey."'>
<input type='submit' value='Usuń zamówienie'></form></td></tr>";
echo "</table></center>";
//echo count($row);
mysqli_free_result($wynik_zapytania);
if(mysqli_connect_errno()) {
echo "Nie dodano<br>";
return 'Nie działa :o';
}else{
//echo "Wczytano dane z bazy";
}
if(!mysqli_close($link)) {return 'Problem z zamknieciem bazy';}
return $row;
}
?>
</body>
</html>