tags:

views:

184

answers:

1

The following code;

//... connect to mysqli database
$xyz = array();
$xyz[] = new Object();
$xyz[] = new Object();
apc_store("xyz", new ArrayObject(xyz), 600);
$xyz = apc_fetch("xyz");
mysqli_close($link);

causes mysqli_close to throw;

Error Type: mysqli_close() [function.mysqli-close]: Couldn't fetch mysqli (WARNING)

I need to store xyz as an ArrayObject, otherwise apc won't store the objects.

Is there some other way to do this? Presumably it's a bug in APC?

A: 

mysqli_close() requires a link to be passed as a parameter. This link is what mysqli_connect function returns:

<?php
$link = mysqli_connect('localhost', 'my_user', 'my_password', 'my_db');

// run your queries here
...

mysqli_close($link);
RaYell
Opps, sorry I do have a link there in the test version - just wrote that pseudo-code in there. That's not the problem.
zemaj
Can you post your whole code, including your connection. I think it may have been broken before that and that's not `apc_fetch` that causes this error.
RaYell