rendered paste body<?php include('../lib/db.php'); $file = 'sql_cache.txt'; $expire = 5; if (file_exists($file) && filemtime($file) > (time() - $expire)) { $records = unserialize(file_get_contents($file)); } else { $db = new DB('test'); $db->connect("localhost", "root", "aususa"); $records = $db->Query("SELECT * FROM categories"); $OUTPUT = serialize($records); $fp = fopen($file,"w"); fputs($fp, $OUTPUT); fclose($fp); $db->disconnect(); } foreach ($records as $id=>$row) { if ($row['category_id'] == $_REQUEST['category_id']) { print '<h3>'.$row['category_name'].'</h3><br />'; } else { print $row['category_name'].'<br />'; } }?>