Christian F. Posted August 17, 2012 Share Posted August 17, 2012 Hmm... Odd indeed. Might be the template engine that messed it up, or something else. Did you try a step-by-step debugging on this one, perchance? Anyway, nice to hear that you solved it, even though the solution was sub-optimal. Quote Link to comment https://forums.phpfreaks.com/topic/266809-mysql-num_rows-shows-3-results-fetch-array-outputs-only-2/page/2/#findComment-1370135 Share on other sites More sharing options...
Ivan Ivković Posted August 17, 2012 Author Share Posted August 17, 2012 Hmm... Odd indeed. Might be the template engine that messed it up, or something else. Did you try a step-by-step debugging on this one, perchance? Anyway, nice to hear that you solved it, even though the solution was sub-optimal. All my template class does is recieve the data ( template -> any_attribute ) and loads the template (loadTemplate). It does not change the variable/mysqli result object in any way, why should it? Damn strange. <?php class Template{ public $vars; private $registry; public function __construct($registry){ $this -> registry = $registry; } public function __set($index, $value){ $this -> vars[$index] = $value; } public function loadTemplate($tpl){ $path = $this -> registry -> router -> dir_path . '/' . $tpl . '.php'; if(file_exists($path) == false){ throw new Exception('Template not found in '. $path); return false; } if(!empty($this -> vars)){ foreach($this -> vars as $key => $value){ $$key = $value; } } include($path); } } I do not see the problem here. Do you maybe? About sub-optimal. Yea I know.. :/ Nothing's perfect I guess. Quote Link to comment https://forums.phpfreaks.com/topic/266809-mysql-num_rows-shows-3-results-fetch-array-outputs-only-2/page/2/#findComment-1370333 Share on other sites More sharing options...
Christian F. Posted August 17, 2012 Share Posted August 17, 2012 Might be the foreach, but again: I cannot say anything with any degree of certainty, without having gone through a step-by-step debug. Only then will I be able to see exactly where it happens, and thus find out why. Quote Link to comment https://forums.phpfreaks.com/topic/266809-mysql-num_rows-shows-3-results-fetch-array-outputs-only-2/page/2/#findComment-1370346 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.