SQL LIKE问题如果我想从我的user_id中选择1,它会选择1,10和11

I'm not really familiar with SQL and right now i have a problem with my query and it drives me insane i have 11 records with id and the id is just 1, 2, 3, .... and now if i have this query i want it to only output the record with id 1 but it also outputs records 10 and 11

This is my Query:

SELECT * FROM products WHERE id LIKE ?

and the bind parameter is:

$id

which in this case is 1 ($_GET['id'])

Thanks in Advance

Like does pattern matching and is used in conjunction with wildcard keys to find similar results. You are looking for an exact value, so just directly compare with an equal sign:

SELECT * FROM products WHERE id =

Using like, you could find anything containing a 1

id like '%1%'

or two digits where the first digit is a 1

id like '1_'

Here is the docs on TSQL's like operator. But think you just need =... https://msdn.microsoft.com/en-us/library/ms179859.aspx

try to replace "LIKE" by "=" in your query