Regarding the odd quotation; SQL injection occurs where the encoder does not sanitize user input for dangerous characters such as single quotes — consider the following statement
SELECT * FROM admin WHERE username='$_GET["user"]' and password='$_GET["pass"]'
if I know that the valid user is an “administrator” and inserts 'or 1=1 , I will follow
SELECT * FROM admin WHERE username='admin' and password='something' or 1=1
This will always return the request, because the left side of the expression will always be true, regardless of the password value.
This is the simplest example of SQL injection, and you will find that the attacker will not need to use a quote at all, or perhaps comment on the rest of the query with a comment, for example -- or /* if there are more parameters after the input point.
Regarding HEX encoding, there may be several reasons that exclude filtering, it is easier to use hexadecimal encoded values, because you do not need to worry about quoting all your values in the query. This is useful if you want to use concat to jointly designate two fields as follows:
inject.php?id=1 and 1=0 union select 1,2,concat(username,0x3a3a,password) from admin
To make the third line visible, go back to isntance admin::admin . If I had not used hexadecimal encoding, I would have to do this:
inject.php?id=1 and 1=0 union select 1,2,concat(username,'::',password) from admin
This may be a problem with the aforementioned addslashes function, but also with poorly written regex processing functions, or if you have a very complex query.
Sql injection is a very broad topic, and what I covered is hardly even an introduction.