In order to Query results from a Database Using PHP MySqli make sure that you have the following steps taken care of.
- You Created A Database
- You Granted Privileges to the database
- Created a config.php file to access the database
- Make sure you Connect to a Database before using this code.
- Make sure there are entries in the database your are trying to call from!
Query results from a Database Using PHP MySqli
Now take the following code to query results from a database. Replace the X's with whatever table row you are trying to fetch.
$result = $db->query("SELECT * FROM XXX") ;
while ($row = $result->fetch_assoc()) {
echo $row['XXX'];
}