I'm trying to display some specific data from MySQL to the PHP web but I'm always getting 0 results . the code i used is:
<?php
$conn = mysqli_connect("localhost", "root", "", "summary");
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$user= .$_SESSION["username"];
$sql = "SELECT money FROM users WHERE username= .$user";
$result = $conn->query($sql);
if (!empty($result) && $result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo "<tr><td>" . $row["money"];
}
echo "</table>";
} else { echo "0 results"; }
$conn->close();
?>