leachus2002 Posted December 1, 2010 Share Posted December 1, 2010 Hi All, Is there any way that PHP can detect if a page has been refreshed? Basically I have a form that when submitted, inserts a row in to a database, but I am finding that when I refresh the page, it repeats the insert statement. Any ideas? Thanks Matt Quote Link to comment Share on other sites More sharing options...
litebearer Posted December 1, 2010 Share Posted December 1, 2010 Use INSERT IGNORE rather than INSERT. If a record doesn't duplicate an existing record, MySQL inserts it as usual. If the record is a duplicate, the IGNORE keyword tells MySQL to discard it silently without generating an error. Quote Link to comment Share on other sites More sharing options...
leachus2002 Posted December 1, 2010 Author Share Posted December 1, 2010 Hi There, Unfortunately, this didnt work. Could this be cause I am using an identity column, thus not making the columns identical? Cheers Matt Quote Link to comment Share on other sites More sharing options...
dragon_sa Posted December 1, 2010 Share Posted December 1, 2010 you could possible process the form on a seperate page then use the header function to return to your form Quote Link to comment Share on other sites More sharing options...
redfort Posted December 1, 2010 Share Posted December 1, 2010 use some paramters to identify the submit and refresh ......it works............ Quote Link to comment Share on other sites More sharing options...
leachus2002 Posted December 1, 2010 Author Share Posted December 1, 2010 Like the submit param's - can anyone prompt my memory? Thanks Matt Quote Link to comment Share on other sites More sharing options...
litebearer Posted December 1, 2010 Share Posted December 1, 2010 Could this be cause I am using an identity column, thus not making the columns identical? Please show your code and db structure Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.