I'm trying to execute a SQLi but the mysql gives a error response. The input should comment everything from after the two dashes out so it can result in this: '%'
. Instead it gives this error: '--%'
'.
This is the code I'm using to execute the query with.
if(isset($_GET['test'])){
$test = $_GET['test'];
//test
$res = $db->run_query_find_all( "SELECT * FROM product WHERE name LIKE '%$test%'");
while($product = $res->fetch_assoc()){
print_r($product);
}
}
Input
';--
In editor example:
Response:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '--%'' at line 1
Update
I still get an error even if I simplify my SQLi
. When I do a POST request with the same query it shows no errors, but shows all the rows of the Product table which means the SQLi
was succesfull.
Input: '--
Input: '#