I have been stuck for the past week trying to learn MySQL on my computer. I have a database called users and a table called users with data in the table. But I have this PHP code below and it will not get anything for results and I don't know why.
<?php
//Connect to database
$link = mysqli_connect('localhost', 'root', '');
//Detect if it was unable to connect to database
if (mysqli_connect_error()) {
die('Unable to connect to database.');
}
//Works?
$query = 'SELECT * FROM users';
//Not working...
if ($result = mysqli_query($link, $query)) {
echo 'It Works!';
}
?>