![]() |
or_where query - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: or_where query (/showthread.php?tid=75753) |
or_where query - oliver - 03-12-2020 Hi, 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() Call to a member function first() on null How can I use or_where? Thanks! RE: or_where query - oliver - 03-12-2020 found the answer here (p. 320) using Query builder : https://www.procoversfx.com/download/codeigniter/CodeIgniter4.0.0-beta.1.pdf $db = $this->builder(); $query = $db->select('id, nom') ->where('name', $name) ->orWhere('name1', $name) ->get(); return count($query->getResult()); |