Jump to content

[SOLVED] Fatal error: Trying to clone an uncloneable object of class mysqli_result


JoeBuntu

Recommended Posts

I get this error on the simple code below. Google did not offer much help.

 

Yes I did make sure that my php.ini file had zend.ze1_compatibility_mode set to "off"- which it was. I restarted apache just to make sure- still no good.

 

also- I have checked the result, it works fine- just I can't clone it.

Am I going about this the wrong way, perhaps?

 

<?php
//code

$result = $db->query($query);
$ted = clone $result;
?>

I am passing the result to a class. I need to use the result in a couple places in the class.

 

if I store the result as I have below, anytime I run $result->fetch_Object, a record of data is lost. I need to be able to run fetch_object a few times within my class and preserve the data. I thought cloning would be a good solution for this.

<?php
 public function __construct($displayFields, $mysqliResult)
 {
 	$this->_data = $mysqliResult;
                $this->somefunction($mysqliResult);

 }
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.