Fetching results from database

Once you have a resource returned from a mysql_query function, you can use it to retrieve the data you want. The simplest way to do this is to fetch the cells you want, one at a time, using the mysqli_query function.

Example

<?php
$con = mysqli_connect("localhost", "username", "password", "database");

// Check connection
if (mysqli_connect_errno()) {
    echo "Failed to connect to MySQL: " . mysqli_connect_error();
}

// execute query
$Query = "SELECT * FROM newrecords";
$result = mysqli_query($con, $Query);

// displaying results
echo "<ul>";
while ($row = mysqli_fetch_array($result)) {
    echo '<li>' . $row['ID'] . '</li>'; /* name of the database column ID */
    echo '<li>' . $row['Name'] . '</li>'; /* name of the database column Name */
}
echo "</ul>";

?>