// The useragent column contains the wildcarded pattern to match against
// our full-length string while the ORDER BY chooses the most-specific
// matching pattern.
$user_agent_properties=Database::getConnection()->query("SELECT * FROM {browscap} WHERE :useragent LIKE useragent ORDER BY LENGTH(useragent) DESC",[':useragent'=>$user_agent])
$user_agent_properties=Database::getConnection()->query("SELECT * FROM {browscap} WHERE LOWER(:useragent) LIKE LOWER(useragent) ORDER BY LENGTH(useragent) DESC",[':useragent'=>$user_agent])