1234567891011121314151617181920212223242526272829303132 |
- <?php
- $host = "kurek620.beget.tech";
- $username = "kurek620_baze";
- $password = "6910WASD579h";
- $database = "kurek620_baze";
- $mysql = new mysqli($host, $username, $password, $database);
- if($mysql->connect_error){
- die("Ошибка подключения". $mysql->connect_error);
- }
- $product_id = $_GET["product_id"];
- // Запрос к базе данных для получения цены товара
- $sql = "SELECT price FROM Products WHERE id = $product_id";
- $result = $mysql->query($sql);
- if ($result->num_rows > 0) {
- $row = $result->fetch_assoc();
- echo $row["price"];
- } else {
- echo "Цена не найдена";
- }
- ?>
|