What are alternative methods to MYSQL_result for retrieving query results in PHP?

The MYSQL_result function is deprecated in newer versions of PHP and should not be used to retrieve query results. Instead, developers can use alternatives such as mysqli_fetch_array, mysqli_fetch_assoc, or mysqli_fetch_object to fetch rows from a result set.

// Connect to the database
$mysqli = new mysqli("localhost", "username", "password", "database");

// Run a query
$result = $mysqli->query("SELECT * FROM table");

// Fetch rows using mysqli_fetch_assoc
while ($row = $result->fetch_assoc()) {
    // Process the row data
    echo $row['column_name'] . "<br>";
}

// Close the connection
$mysqli->close();