What is the equivalent of mysql_result in mysqli and why is it deprecated?

The equivalent of mysql_result in mysqli is to use mysqli_fetch_array or mysqli_fetch_assoc to retrieve the result set and then access the specific column value directly. The mysql_result function is deprecated in mysqli because it is not secure and can lead to potential SQL injection vulnerabilities.

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

// Run query
$result = $mysqli->query("SELECT column_name FROM table_name WHERE condition");

// Fetch the result set
$row = $result->fetch_assoc();

// Access the specific column value
$column_value = $row['column_name'];

// Free the result set
$result->free();

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