$id = $_GET['id'];
$id = str_replace("'", "", $id);
$sql = "select name from test where id='$id'";
$stmt = $conn->query($sql);
As the PHP code snippet above, it removes all single quotes from the user input, and then put it in a SQL query. Whatever it gets from the user is not able to escape from the quotes surrounding them, it seems safe from SQL injection. I am quite curious about how to inject SQL code to this.
Some question said about escaping quotes, which has examples to exploit it. But in my occasion, removing all quotes isn't really the same as escaping.
I know there is the parameterized query way to prevent SQL injection. It's possible that single quotes are contained in the input data. I am asking this question out of curiosity to learn about SQL injection. I want to know are there any examples to exploit this code?