$input = "\\'"; # these two backslashes will print a single backslash in the SQL, but, as I will add one backslash before the single quote, the result there will be just the same as you can see here.
####
select username, password from users where sid='$input';
####
5' or 1='1
####
5\\' or 1=\\'1
####
...where sid=' 5\\' or 1=\\'1 ';
####
\\