You can try to detect this event from the browser back button with javascript in this way. But I'm not sure if it will work fully for the purpose you need:
var url = "http://localhost/seuaplicativo/updateBanco.php";
function updateBanco(e) {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if(this.readyState == 4 && this.status == 200) {
console.log("Sucesso");
}
};
xhttp.open("GET", url+"?url="+encodeURI(document.location), true);
xhttp.send();
}
window.onpopstate = updateBanco;
And in PHP do something similar to this:
updateBanco.php
$url = $_GET["url"];
$banco = mysql_query("localhost", "root", "");
$db = mysql_select_db("controle_de_navegacao");
$query = mysql_query("INSERT INTO tabela (id, url) VALUES (NULL, "{$url}")");
echo $query ? "OK" : "OPS";
?>
What happens: When javascript detects the browser's forward or backward function, it will trigger a request to PHP on the server that will do the registration you expect.