Daniel Daniel - 1 year ago 105
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?

Answer Source

Using PDO and assuming MySQL

$stmt = $db->prepare('SELECT * FROM table WHERE LOWER(`field`) = ?');
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download