CodeIgniter Forums

Full Version: or_where query
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Having great fun with new release of CI4!
Great job guys!

I'm trying to run a query that fetches 1 row where either of fields (name or name1) equals "$name".

PHP Code:
return $this->asArray()
Can somebody explain why I get the following error?
Call to a member function first() on null

How can I use or_where?

found the answer here (p. 320) using Query builder :
$db = $this->builder();
$query = $db->select('id, nom')
->where('name', $name)
->orWhere('name1', $name)
return count($query->getResult());