Advertisement
Guest User

login

a guest
May 26th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. <html>
  2.  
  3. <head>
  4. <meta charset="utf-8">
  5. </head>
  6.  
  7. <?php
  8.  
  9. include("connect.php");
  10.  
  11.  
  12. $sql = "SELECT * FROM orderdetaljer, orders, kund WHERE orderdetaljer.orderid = orders.orderid AND orders.kundid = kund.kundid ORDER BY orderdetaljer.orderid" ;
  13.  
  14.  
  15. $result = mysqli_query($conn,$sql) or die(mysqli_error($conn));
  16.  
  17.  
  18. $newId = false;
  19. $lastOrderID = 0;
  20.  
  21. function last(){
  22. global $lastOrderID;
  23. return $lastOrderID;
  24. }
  25. function setLast($last){
  26. global $lastOrderID;
  27. $lastOrderID = $last;
  28. }
  29.  
  30. while($row = $result->fetch_assoc() ) {
  31. $lastOrderID = last();
  32. $thisOrderId =$row["orderid"];
  33.  
  34. if($lastOrderID!=$thisOrderId){
  35.  
  36. ?>
  37. <form method="post">
  38. <?php
  39. echo "<input type='submit' name='send' value=$row[orderid] > ";
  40. ?>
  41. </form>
  42. <?php
  43.  
  44. echo " Namn: " . $row["fnamn"];
  45. echo ", OrderId: " . $row["orderid"]. ", ProdId: " . $row["prodid"]. ", Amount: " . $row["antal"] . ", Adress: " . $row["adress"]. ", OrderDatum: " . $row["orderdate"] . ", SendDatum: " . $row["senddate"];
  46. }else{
  47. echo "OrderId: " . $row["orderid"]. ", ProdID: " . $row["prodid"]. ", Amount: " . $row["antal"] . " ";
  48.  
  49.  
  50. }
  51. echo "<br/><br/>";
  52. setLast($thisOrderId);
  53.  
  54.  
  55. }
  56. if(isset($_POST['send'])){
  57.  
  58. $date = "UPDATE orders SET senddate = now() WHERE orderid = " . $_POST['send'];
  59. $conn->query($date);
  60. }
  61.  
  62. ?>
  63.  
  64. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement