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. Link to comment https://forums.phpfreaks.com/topic/124811-refreshing-a-page-after-updating-database/ Share on other sites More sharing options...
HeaDmiLe Posted September 18, 2008 Share Posted September 18, 2008 header('location:'.basename(__FILE__)); maybe this? Link to comment https://forums.phpfreaks.com/topic/124811-refreshing-a-page-after-updating-database/#findComment-644774 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. Link to comment https://forums.phpfreaks.com/topic/124811-refreshing-a-page-after-updating-database/#findComment-644777 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. Link to comment https://forums.phpfreaks.com/topic/124811-refreshing-a-page-after-updating-database/#findComment-644779 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. Link to comment https://forums.phpfreaks.com/topic/124811-refreshing-a-page-after-updating-database/#findComment-644785 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. Link to comment https://forums.phpfreaks.com/topic/124811-refreshing-a-page-after-updating-database/#findComment-644788 Share on other sites More sharing options...
saco721 Posted September 18, 2008 Author Share Posted September 18, 2008 OK, thanks Link to comment https://forums.phpfreaks.com/topic/124811-refreshing-a-page-after-updating-database/#findComment-644790 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. Link to comment https://forums.phpfreaks.com/topic/124811-refreshing-a-page-after-updating-database/#findComment-644920 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 Link to comment https://forums.phpfreaks.com/topic/124811-refreshing-a-page-after-updating-database/#findComment-644924 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.