Mysql WHERE OR WHERE started with integer weird results

Viewed 144

why is

$query = "SELECT * FROM `users` WHERE `id` = '$search' OR `email` = '$search' LIMIT 1";

`id` = UNSIGNED INTEGER(10), `email` = VARCHAR(255)

why is the query results so weird, i think the image is self explained, but i need some word too, so here it is, when user search dcm2@example.com or anything else not exists, no results, but if the string start with number and searching the PRIMARY KEY, it turn the string to integer, if i search 2dcm1@example.com, the ID 2 return, any good explaination and why is this happend?

enter image description here

enter image description here

enter image description here

1 Answers
Related