I used the following code, but it is taking time. i want to cache without storing in a text file.
$file = 'cache_toppers.txt';
if (file_exists($file) &&
filemtime($file) > (time() - $expire)) {
$records = unserialize(file_get_contents($file));
} else {
include("kalvidbconnect.php");
$query = "SELECT * FROM vpfmsttoppers";
$result = mysql_query($query)
or die (mysql_error());
while ($record = mysql_fetch_array($result) ) {
$records[] = $record;
}
$OUTPUT = serialize($records);
$fp = fopen($file,"w");
fputs($fp, $OUTPUT);
fclose($fp);
}
Thanks, Kamatchi.D