note 105808 deleted from ref.sqlite by cmb

From: Date: Mon, 02 Nov 2020 14:57:03 +0000
Subject: note 105808 deleted from ref.sqlite by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-215710@lists.php.net to get a copy of this message
Note Submitter: CraquePipe ---- The SQLite manual mentions that queries are done in a case-sensitive way, this means your query must be the correct case. It also mentions that using the "LIKE" operator will do a case-insensitive selection. This is true, but this also introduces wildcard symbols which a user could enter without getting filtered by the SQLite escape function. I'm somewhat new to SQL and I didn't think of doing this before, even after looking for a decent way to do case-insensitive queries. For case-insensitive queries, simply use the built in "lower" function. <?php // ... $name = 'bARbarA'; $rows = $db->arrayQuery('select * from blah where lower(name) = lower(\''.sqlite_escape_string($name).'\');'); // $rows might contain an entry for "Barbara" now. ?>

« previous php.notes (#215710) next »