ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL);
I recommend adding this code before session_start(); to see errors. And add "quotes"
SELECT `reputation` FROM `users` WHERE `login` = '$login'
Slightly reworked code to see what's really going on.
<?php ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); session_start(); ?> <html> <head> <title>Мой профиль</title> </head> <body> <p> Ваша репутация: <?php include 'bd.php'; $reputations = mysqli_query($db, "SELECT `reputation` FROM `users` WHERE `login` = '$login'"); $row = mysqli_fetch_assoc($reputations); echo '<pre>'; print_r($row); echo '</pre>'; ?> </p> </body> </html>
This code will display $row as an array. If it is still empty, you need to look for an error in the syntax or in the file 'bd.php'; .
echo '<pre>'; print_r($row); echo '</pre>';
In general, I still recommend redoing under PDO .
<?php ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); $pdo = new PDO("mysql:host=localhost;dbname=DBNAME;charset=utf8", 'root', 'PASSWORD'); $pr = $pdo->prepare("SELECT `reputation` FROM `users` WHERE `login` = :login"); $pr->execute(array( 'login' => $login )); $data = $pr->fetchAll(); echo '<pre>'; print_r($data); echo '</pre>';
$row = mysqli_fetch_assoc($reputations); echo $row['reputation'];$row = mysqli_fetch_assoc($reputations); echo $row['reputation'];- Edward