开发者

APC not storing data from MySQLi result array

开发者 https://www.devze.com 2023-01-22 14:52 出处:网络
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 My

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-- >";
}
开发者_如何学Go

Can you see what I'm doing wrong?

Thanks


I've solved it.

$key was not set correctly.

0

精彩评论

暂无评论...
验证码 换一张
取 消