JoeBuntu Posted February 23, 2009 Share Posted February 23, 2009 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; ?> Quote Link to comment https://forums.phpfreaks.com/topic/146464-solved-fatal-error-trying-to-clone-an-uncloneable-object-of-class-mysqli_result/ Share on other sites More sharing options...
genericnumber1 Posted February 23, 2009 Share Posted February 23, 2009 Why are you trying to clone it? You can't clone mysqli results I'm fairly sure. Quote Link to comment https://forums.phpfreaks.com/topic/146464-solved-fatal-error-trying-to-clone-an-uncloneable-object-of-class-mysqli_result/#findComment-768914 Share on other sites More sharing options...
JoeBuntu Posted February 23, 2009 Author Share Posted February 23, 2009 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); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/146464-solved-fatal-error-trying-to-clone-an-uncloneable-object-of-class-mysqli_result/#findComment-768931 Share on other sites More sharing options...
JoeBuntu Posted February 23, 2009 Author Share Posted February 23, 2009 Can anyone help? Quote Link to comment https://forums.phpfreaks.com/topic/146464-solved-fatal-error-trying-to-clone-an-uncloneable-object-of-class-mysqli_result/#findComment-769157 Share on other sites More sharing options...
Mchl Posted February 23, 2009 Share Posted February 23, 2009 Can't you rewind the result to beginning using mysqli_result::data_seek ? Never tried it, so I'm not sure. Quote Link to comment https://forums.phpfreaks.com/topic/146464-solved-fatal-error-trying-to-clone-an-uncloneable-object-of-class-mysqli_result/#findComment-769169 Share on other sites More sharing options...
sasa Posted February 23, 2009 Share Posted February 23, 2009 http://www.cit.gu.edu.au/doc/php_doc/function.mysqli-store-result.html Quote Link to comment https://forums.phpfreaks.com/topic/146464-solved-fatal-error-trying-to-clone-an-uncloneable-object-of-class-mysqli_result/#findComment-769180 Share on other sites More sharing options...
JoeBuntu Posted February 23, 2009 Author Share Posted February 23, 2009 Thanks- the seek function worked perfect for me. Quote Link to comment https://forums.phpfreaks.com/topic/146464-solved-fatal-error-trying-to-clone-an-uncloneable-object-of-class-mysqli_result/#findComment-769377 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.