PHP-MySQLi-Database-Class icon indicating copy to clipboard operation
PHP-MySQLi-Database-Class copied to clipboard

LIKE condition

Open MazettePatacaisse opened this issue 9 years ago • 3 comments

Hello, First of all, a big thank's to your works!

I want to know if the LIKE condition ca be used with getvalue ? I need to count rows with LIKE condition. Example: ("select count(*) from email_bans where mail_domain LIKE '%$maildomain%'") Thank's for your help

MazettePatacaisse avatar Jan 13 '17 07:01 MazettePatacaisse

Use rawquery

ATouhou avatar Jan 16 '17 22:01 ATouhou

Or just use where(), this should do the job:

$db->where('mail_domain', '%'.$maildomain.'%', 'like');
$bannedCount = $db->getValue('email_bans', 'count(*)');

ricwein avatar Jan 17 '17 15:01 ricwein

It's working thank's for your help!

MazettePatacaisse avatar Jan 30 '17 15:01 MazettePatacaisse