All pastes #966604 Raw Edit

Someone

public php v1 · immutable
·published 2008-04-01 21:17 UTC
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 />';	    }	}?>