Answer the question
In order to leave comments, you need to log in
Why does he not want to pull data from the database or does the variable not work?
<?php
$host = 'localhost'; // Хост, у нас все локально
$user = 'test1'; // Имя созданного вами пользователя
$pass = 'testtest11122'; // Установленный вами пароль пользователю
$db_name = 'user1213408_test'; // Имя базы данных
$link = mysqli_connect($host, $user, $pass, $db_name); // Соединяемся с базой
// Ругаемся, если соединение установить не удалось
if (!$link) {
echo 'Не могу соединиться с БД. Код ошибки: ' . mysqli_connect_errno() . ', ошибка: ' . mysqli_connect_error();
exit;
}
?>
<?php
if (isset($_GET['id'])) {
$sql = mysqli_query($link, "SELECT `ID`, `Name`, `Price`, `Nickname` FROM `product` WHERE `ID`={$_GET['id']}");
$product = mysqli_fetch_array($sql);
$order_id = isset($_GET['id']) ? $product['ID'] : '';
$description = isset($_GET['id']) ? $product['Name'] : '';
$amount = isset($_GET['id']) ? $product['Price'] : '';
$login = isset($_GET['id']) ? $product['Nickname'] : '';
}
?>
<?=$amount;?>
" . $login . "
Answer the question
In order to leave comments, you need to log in
one)
WHERE `ID`={$_GET['id']}for this, in a decent society, they beat the clave on the kumpol, until complete enlightenment.
To work with the database, I highly recommend using RedBeanPHP ORM . Very good and handy item.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question