What are some potential pitfalls of storing static pages in a database using PHP?

Storing static pages in a database using PHP can lead to slower performance due to the overhead of querying the database for each page request. To solve this issue, consider caching the static pages in memory or on disk to reduce the number of database queries and improve overall performance.

// Example of caching static pages in PHP
function get_static_page($page_id) {
    $cache_key = 'static_page_' . $page_id;
    
    // Check if the page is cached
    if ($cached_page = apc_fetch($cache_key)) {
        return $cached_page;
    }
    
    // If not cached, query the database and store in cache
    $page_content = query_database_for_page($page_id);
    apc_store($cache_key, $page_content);
    
    return $page_content;
}