{"id":180,"date":"2013-10-30T16:04:31","date_gmt":"2013-10-30T13:04:31","guid":{"rendered":"http:\/\/meekconsulting.com\/?p=180"},"modified":"2022-01-08T16:26:32","modified_gmt":"2022-01-08T13:26:32","slug":"preventing-caching-in-php","status":"publish","type":"post","link":"https:\/\/meekconsulting.com\/?p=180","title":{"rendered":"Preventing caching in php"},"content":{"rendered":"<p>Sometimes when you have php programs that render data from databases, after updating the data from a webpage the server will cache the results from before the update effectively showing wrong data.<\/p>\n<p>We found this to be especially problematic with MSIE. Internet Explorer seems to try to re-use the data when we navigate between jquery tabs in IE.<\/p>\n<p>To fix this we made the programs that render the tab content send these HTTP headers to prevent cacheing:<\/p>\n<blockquote><p>\/\/Set no caching<br \/>\nheader(&#8220;Expires: Mon, 28 Jul 1997 05:00:00 GMT&#8221;);<br \/>\nheader(&#8220;Last-Modified: &#8221; . gmdate(&#8220;D, d M Y H:i:s&#8221;) . &#8221; GMT&#8221;);<br \/>\nheader(&#8220;Cache-Control: no-store, no-cache, must-revalidate&#8221;);<br \/>\nheader(&#8220;Cache-Control: post-check=0, pre-check=0&#8221;, FALSE);<br \/>\nheader(&#8220;Pragma: no-cache&#8221;);<\/p><\/blockquote>\n<p>This seems to solve the problem.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes when you have php programs that render data from databases, after updating the data from a webpage the server will cache the results from before the update effectively showing wrong data. We found this to be especially problematic with &hellip; <a href=\"https:\/\/meekconsulting.com\/?p=180\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-180","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/meekconsulting.com\/index.php?rest_route=\/wp\/v2\/posts\/180","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meekconsulting.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meekconsulting.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meekconsulting.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/meekconsulting.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=180"}],"version-history":[{"count":2,"href":"https:\/\/meekconsulting.com\/index.php?rest_route=\/wp\/v2\/posts\/180\/revisions"}],"predecessor-version":[{"id":185,"href":"https:\/\/meekconsulting.com\/index.php?rest_route=\/wp\/v2\/posts\/180\/revisions\/185"}],"wp:attachment":[{"href":"https:\/\/meekconsulting.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=180"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meekconsulting.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=180"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meekconsulting.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=180"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}