PHP Classes

File: Example2.php

Recommend this page to a friend!
  Classes of Ivan Priorov   keeper   Example2.php   Download  
File: Example2.php
Role: Example script
Content type: text/plain
Description: Example file
Class: keeper
Store and retrieve keys in array static object
Author: By
Last change:
Date: 13 years ago
Size: 299 bytes
 

Contents

Class file image Download
<?php
require_once 'Keeper.php';
/*
 * The repetitive requests to the database...
 */
$query = "SELECT * FROM `users` WHERE `id`=12";
$key = md5($query);
if (
Keeper::exists($key)) {
   
$array = Keeper::get($key);
} else {
   
$array = mysql_fetch_assoc(mysql_query($query));
   
Keeper::set($key, $array);
}