In Statement for MySQL

34 views
Skip to first unread message

Loki

unread,
Nov 11, 2016, 7:33:55 AM11/11/16
to Fat-Free Framework
Hi Folks,

I would like to know if o can use the IN Statement in the Mapper.

i ftried it like this but that does not work.
Or is there another method i can use to pass an array of of or clauses

 public function getByTeamId($TeamID)
    {
        $this->load(array('TeamID IN ?','(1,2,3)'));
        return $this->query;
    }

ved

unread,
Nov 11, 2016, 7:49:50 AM11/11/16
to Fat-Free Framework
Hi, not tested, but try using:

$this->load(array('TeamID IN (?)', '1,2,3'));


ikkez

unread,
Nov 11, 2016, 8:25:21 AM11/11/16
to Fat-Free Framework
I've found this thread: https://groups.google.com/d/topic/f3-framework/-Pbi-eh8ch0/discussion

I'd suggest something like this:

$values = array(1,2,3);
$this->load(array_merge(['TeamID IN ('.str_repeat('?,', count($values) - 1).'?)'],$values));
(not tested)
Reply all
Reply to author
Forward
0 new messages