You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.4KB

  1. <!DOCTYPE html>
  2. <html>
  3. <title>Uzskaitam briketes</title>
  4. <meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1">
  5. <link rel="stylesheet" href="/include/css/w3.css">
  6. <?php
  7. include('include/db.php');
  8. //Attēlojam, cik brikešu ir atlicis.
  9. $meklejam = "SELECT * FROM Briketes WHERE BrikID = 1;";
  10. $result = mysqli_query($conn,$meklejam);
  11. ?>
  12. <div class="w3-container w3-center">
  13. <form action="" method="POST">
  14. <h2>Reģistrēt iztērētās briketes</h2>
  15. <?php while($row = mysqli_fetch_assoc($result)) {
  16. echo '<h3>Atlikuši '.$row['BrikAtlicis'].' iepakojumi</h3>';
  17. } ?>
  18. <img width=300px height=300px src="/img/briketes.png" alt="Briketes">
  19. <br>
  20. <input type="submit" name="pievienot" class="w3-button w3-jumbo w3-green" value="-1">
  21. </form>
  22. </div>
  23. <?php
  24. //Ja ir isset +1
  25. if(isset($_POST['pievienot']))
  26. {
  27. $psk = 1;
  28. //formejam pieprasījumus
  29. $pievienot = "insert into Paterins (PatDaudzums) VALUES ($psk)";
  30. $atnemt = "UPDATE Briketes SET BrikAtlicis = BrikAtlicis-1 WHERE `BrikID` = 1";
  31. mysqli_query($conn,$atnemt);
  32. if (mysqli_query($conn,$pievienot)) {
  33. //echo "New record created successfully";
  34. } else {
  35. //echo "Error: " . $pievienot . "<br>" . mysqli_error($conn);
  36. }
  37. echo ' <style>
  38. body {
  39. background-color: green;
  40. opacity: 5.9;
  41. }
  42. </style>';
  43. header( "refresh:2;url=index.php" );
  44. }
  45. ?>

Powered by TurnKey Linux.