Im working on a script for a simple top five, I get the data from MySQL and then output it in a table.. And i get this: But when I delete the data from the database or i change something in the database, it doesnt update it automatically, I have to click F5 or clear the cache in order to see the new data.. How can i resolve this problem ?
are you talking about the page displayed doesn't auto-adjust the info? Or even when you reload the page it doesnt show the change? If so, the data wont change without a page reload unless you're using AJAX , and if you are reloading your page a couple times, that's your browser setting = 'check for new content every time'
You could also play with the META tags to adjust how the browser cache behaves but, yes, AJAX is your best bet. Make sure you pass a randomly generated number into your AJAX parameter string. AJAX results can also be frequently cached - sending a random number with the call guarantees a fresh pull every time.
for aesthetic and for use-ability I would go with AJAX. This will make it so that when a user clicks on, or updates anything the results will be immediately loaded to the AJAX display on your webpage WITHOUT any page reloads and you won't have concern with the cache settings of your visitors/users. I make all sorts of AJAX scripts and functionality and sell them in bulk for customizing your own systems or using whats provided. If you decide to go with AJAX i have plenty of copy/paste and easy customize-ables. let me know in IM
META tags do now work all the times Best solution would be to use AJAX as mentioned above You can work also with JavaScript as follows: Put this in the head tag. The script uses two cookies: - one to store if the page has been visited - one to store if the reaload has been triggeredif(navigator.cookieEnabled){ var visited=0; var refreshing=0; if(Get_Cookie('visited')) { visited=parseInt(Get_Cookie('visited')); } if (Get_Cookie('refreshing')) { refreshing=parseInt(Get_Cookie('refreshing')); } if(visited==1){ if(refreshing==0){ window.document.cookie = 'refreshing=1'; window.location.reload(); }else{ window.document.cookie = 'refreshing=0'; } }else{ window.document.cookie = 'visited=1'; } }