I'm developing a PHP-MySQL app that enables registered users to enter text comments. Problem is:
I was thinking 3 options:
Now in the context of my application, my concerns with OPTION 1 and OPTION 2 is performance PHP-MySQL since I already have various queries within the same page that push/get data from databases. So OPTION 3 may target the issue differently.
Questions is: If I go for OPTION 3 can this be considered a Best Practice? meaning clearing the browser cache is the best most effective solution? I have read that there are consequences too? your thoughts are appreciated!
You might notice that when you clear cache, it comes back eventually. This is normal; over time, apps will build up cache again based on your usage. Because cache is useful, you shouldn't worry when an app builds up cached files. Clearing cache shouldn't log you out of apps or cause any other major changes.
The clearstatcache() function clears the file status cache. PHP caches data for some functions for better performance. If a file is to be checked several times in a script, you probably want to avoid caching to get correct results. To do this, use the clearstatcache() function.
Just do a redirect after submitting data to the database. It's a common practise.
An http redirect instructs the browser to issue an http GET
for the url specified (as opposed to the http POST
that is used to submit the form) . If you do this right after you have inserted data into the database, when the user refreshes his browser nothing will happen other than him seeing the same page again.
This question on SO tells how you redirect with php.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With