saco721 Posted September 18, 2008 Share Posted September 18, 2008 Hi, I have a database where one of the fields is quantity, this is displayed on a page. As quantity decrements the user has to click on the browser refresh button to show the changes made to the quantity field in the database. How do I refresh the page without having to click the browser refresh button?. Any help would be greatly appreciated. Quote Link to comment Share on other sites More sharing options...
HeaDmiLe Posted September 18, 2008 Share Posted September 18, 2008 header('location:'.basename(__FILE__)); maybe this? Quote Link to comment Share on other sites More sharing options...
F1Fan Posted September 18, 2008 Share Posted September 18, 2008 Or you could use javascript's window.reload() function. Quote Link to comment Share on other sites More sharing options...
Brian W Posted September 18, 2008 Share Posted September 18, 2008 <META HTTP-EQUIV="refresh" CONTENT="15"> Place that in the <head> and it should refresh every X seconds (right now 15 seconds). Don't go below 3, some browsers don't like it. Quote Link to comment Share on other sites More sharing options...
saco721 Posted September 18, 2008 Author Share Posted September 18, 2008 thanks for the response, have tried meta refresh but I need to refresh after database is updated rather than after a few seconds. Quote Link to comment Share on other sites More sharing options...
F1Fan Posted September 18, 2008 Share Posted September 18, 2008 If that's the case, you'll need to use AJAX. You'll need a javascript function that runs every X seconds or minutes that calls some PHP code to check the DB for any updates. If there are updates, the javascript function should update with the new value. Quote Link to comment Share on other sites More sharing options...
saco721 Posted September 18, 2008 Author Share Posted September 18, 2008 OK, thanks Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted September 18, 2008 Share Posted September 18, 2008 It is likely that the order of your logic is incorrect and is forming the content before the database is being updated. Post your code to get help with what it might be doing. Quote Link to comment Share on other sites More sharing options...
dennismonsewicz Posted September 18, 2008 Share Posted September 18, 2008 I wouldn't use meta tags I would use PHPs header or JS window.reload 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.