I am connected to a database and when I try and get the data stored in it using mysqli_query
it doesn't work. When I echo the $result
nothing shows up. When I use var_dump($result)
I get `bool(false). By the way, the connection is working. Why isn't it working?
I have tried to change the names of the variables, I have read a lot of Q&A from other people and I can't figure out why is it not working.
<?php
require('database/dbconnection.php');
$query = 'SELECT * FROM users';
$result = mysqli_query($conn, $query);
var_dump($result);
$usersDate = mysqli_fetch_all($result, MYSQLI_ASSOC);
var_dump($usersDate);
mysqli_free_result($result);
mysqli_close($conn);
?>
I expected to get the data and var_dump() it. But I cant because the query doesn't work.
$conn is the var I got when I required the dbconnection.php
file