Hechi Hechi - 4 months ago 39
SQL Question

LIKE operator in medoo

How can i use

LIKE
operator in this sql statement using medoo framework?

Original SQL statement:

SELECT id,name FROM table WHERE name LIKE %'foo'%


medoo statement:

$data=$db->select('table',
['id','name'],
['AND' => ['name' => 'foo']
]
);


thanks for your help!

Answer

Use like condition like this [~] Refer the link

$data=$db->select('table',
    ['id','name'],
    ['AND' => ['name[~]' => 'foo']

]);