Skip to content

Instantly share code, notes, and snippets.

@saturngod
Created April 18, 2011 04:12
Show Gist options
  • Save saturngod/924800 to your computer and use it in GitHub Desktop.
Save saturngod/924800 to your computer and use it in GitHub Desktop.
php apc with sql
<?php
$sql="select * from `prize`";
if (apc_exists($sql)) {
print_r( apc_fetch($sql) );
}
else {
$result=mysql_query($sql);
while ($row = mysql_fetch_assoc($user_result)) {
$data[]=$row; // or you can make some process
}
//print the result
print_r($data);
apc_store($sql,$data,86400);//will expire in 86400 seconds
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment