header("Cache-Control: no-cache, must-revalidate");
to tell http/1.1 clients not to cahce the page
header("Expires: May, 17 May 1983 05:00:00 GMT\n");
to tell http/1.0 clients (which won't understand the previous line) not to cache the content
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
Its polite and useful for debugging to put this in - doesn't make any difference to how the page is treated for caching after the former two lines
and where we have to write these lines of codes? on the page where we do databse dealing or just any php pages?
You should never incorporate any code you don't understand in your product. Using caching properly is a good idea though and can save a lot of money. Have a google for Mark Nottinghams tutorial on cacheing for a starter.
C.