There is this function which i want to execute in case the user leaves a particular page. This function will basically change all of the data within a certain column in my d
Since server-side php only runs the server script and then sends the result to the browser you can't do this with php alone. You could send an ajax request to your php script with the onunload event using javascript, and then run the php script in response to that request.