views:

13

answers:

1

Hello, I'm havin trouble storing an array of data. Below is the code use in the web application to check to see if the data is there, and if it's there serve it, else, cache it then serve it. I am using MySQLi

$id = $db->real_escape_string($_GET['id']);
$key = 'content_' . $app; 
$data = apc_fetch($key);
if (!is_array($data)) {  
    $result = $db->query("SELECT * FROM pages_content WHERE id = $id");
    $rawdata = $result->fetch_assoc();
    $data = $result->fetch_array(MYSQLI_ASSOC);  
    apc_store($key, $data);
    echo "<!-- DATA_NOT_FOUND_AND_STORED-- >";
}

Can you see what I'm doing wrong?

Thanks

A: 

I've solved it.

$key was not set correctly.

Shamil