Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 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. echo "<input type='checkbox' name=$row[orderid] value='Bike'> ";
  36.  
  37. echo " Namn: " . $row["fnamn"];
  38. echo ", OrderId: " . $row["orderid"]. ", ProdId: " . $row["prodid"]. ", Amount: " . $row["antal"] . ", Adress: " . $row["adress"]. ", OrderDatum: " . $row["orderdate"] . ", SendDatum: " . $row["senddate"];
  39. }else{
  40. echo "OrderId: " . $row["orderid"]. ", ProdID: " . $row["prodid"]. ", Amount: " . $row["antal"] . " ";
  41.  
  42.  
  43. }
  44. echo "<br/><br/>";
  45. setLast($thisOrderId);
  46.  
  47. }
  48.  
  49.  
  50. ?>
  51.  
  52. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement