add_orders.php 745 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. $host = "kurek620.beget.tech";
  3. $username = "kurek620_baze";
  4. $password = "6910WASD579h";
  5. $database = "kurek620_baze";
  6. $mysql = new mysqli($host, $username, $password, $database);
  7. if($mysql->connect_error){
  8. die("Ошибка подключения". $mysql->connect_error);
  9. }
  10. $product_id = $_POST["productid"];
  11. $count_prod = $_POST["countprod"];
  12. $summ = $_POST["su"];
  13. $id_login = $_POST["id_login"];
  14. $query = "INSERT INTO Orders1 (`product_id`, `count_prod`, `summ`, `id_login`)
  15. VALUES ('$product_id', '$count_prod', '$summ', '$id_login')";
  16. $result = $mysql->query($query);
  17. if(!$result){
  18. echo "Что то не так" . $mysql->error;
  19. }
  20. else{
  21. echo "<script>window.location.href = 'product.php';</script>";
  22. }
  23. ?>