I'm getting this error in my code, the code is posted below as well. Fatal error: Call to a member function fetch_assoc() on boolean in C:\htdocs\www\ourgames\game\admin\functions\function.php on line 41
function getUsers_value(){
global $conn;
$user_id = $_SESSION['user_id'];
$sql = "SELECT id, username, password, email FROM user";
$results = $conn->query($sql);
$row = $results->fetch_assoc();
return $row['id'];
return $row['username'];
return $row['password'];
return $row['email'];
}
this is my connect_game_db.php
$servername = "127.0.0.1";
$username = "root";
$password = "password";
$dbname = "game";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
?>