CanMan2004 Posted January 27, 2007 Share Posted January 27, 2007 HiI have a page which does a query to insert data into a table, but I only want to run the page once as I dont want the same information being added into the database more than once. I have found that if they refresh the page or go back to the page in the history list, the query gets performed again and the data is inserted again.What is the best way to stop people visiting the same page twice, although if another order is placed I want the page to be accessed again as that would be new information being added.Can anyone help?ThanksDave Link to comment https://forums.phpfreaks.com/topic/35995-stop-page-revisits/ Share on other sites More sharing options...
pocobueno1388 Posted January 27, 2007 Share Posted January 27, 2007 Do you have a unique field in the database that can tell the difference between each visitor? If you don't that is what you need to to first by adding something to the table where you are inserting the data to.Then just make a query to the database and check if that information is still there, and if it isn't display the page.[code]<?php$query = mysql_query("SELECT unique_field FROM table WHERE condition");if ( mysql_num_rows($query) <= 0 ){ //DISPLAY PAGE} else {//DONT DISPLAY PAGE}?>[/code] Link to comment https://forums.phpfreaks.com/topic/35995-stop-page-revisits/#findComment-170745 Share on other sites More sharing options...
CanMan2004 Posted January 27, 2007 Author Share Posted January 27, 2007 Thank you very much Link to comment https://forums.phpfreaks.com/topic/35995-stop-page-revisits/#findComment-170782 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.