Search code examples
phpmysqlmedoo

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!


Solution

  • Use like condition like this [~] Refer the link

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