Welcome Guest, Not a member yet? Register   Sign In
find() and findAll() issues
(This post was last modified: 12-24-2021, 03:21 AM by Kolinski.)

Given the following code:
   $cond = array('id'=>'id', 'lang'=>'lang');
   $ret = $this->model->where($cond)->findAll();
   $cond = array('lang'=>'lang');
   $ret = $this->model->where($cond)->find('id');
Both code above working very well when using Google Chrome browser, however return anything (crashes) in all other browsers (IExplorer, Firefox, Edges).

Also, without 'where' clause the code working in all browsers.

Any idea about the issue?

infos: windows 10-64, MariaDB 10.3.15, PHP 7.3.6, CI 4.1.5.


Your problem is probably client side and not server side if it is browser dependent.

Wouldn't more be more logic if you passed variables?

PHP Code:
$cond = array('id'=> $id'lang'=> $lang);

$cond = array('lang'=> $lang); 

This is how I do this in my model

PHP Code:
public function getTest($test_ID)
$this->where(['test_ID'=> $test_ID])->asArray()->findall();

PHP Code:
// wrong
$cond = array('id'=>'id''lang'=>'lang');

// correct way
$cond = array('id' => $id'lang' => $lang); 
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )

Thank you all!
Really, both ID and LANG in the real code are variables.
Someone has made a modification to the source code and hasn't documented it properly. The DB return was dependent on info from a cookie. The cookie was just not present in the mentioned browsers, as it was dependent on the visit to a URL for activation.

Theme © iAndrew 2016 - Forum software by © MyBB