What is the purpose of the mysql_fetch function in PHP?

The mysql_fetch function in PHP is used to fetch a single row from a result set returned by a MySQL query. It is commonly used in conjunction with other MySQL functions to retrieve data from a database and process it within a PHP script.

$result = mysql_query("SELECT * FROM table_name");
$row = mysql_fetch_assoc($result);

// Access data from the fetched row
echo $row['column_name'];