inp_price.php 653 B

1234567891011121314151617181920212223242526272829303132
  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 = $_GET["product_id"];
  11. // Запрос к базе данных для получения цены товара
  12. $sql = "SELECT price FROM Products WHERE id = $product_id";
  13. $result = $mysql->query($sql);
  14. if ($result->num_rows > 0) {
  15. $row = $result->fetch_assoc();
  16. echo $row["price"];
  17. } else {
  18. echo "Цена не найдена";
  19. }
  20. ?>