add_product.php 768 B

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