Daniel Daniel - 5 months ago 52
PHP Question

PHP - How to use strtolower in query

In database I have this field: "TeST" and I dont know where are the caps lock and I just want to strtolower him and to do somthing like that

SELECT * FROM table WHERE strtolower(field) = strtolower($var)

How can I do that?


Using PDO and assuming MySQL

$stmt = $db->prepare('SELECT * FROM table WHERE LOWER(`field`) = ?');