Should i also sanitize data coming from $_GET if those data are not going to change the state of database.
example of changing the state of database is INSERT, DELETE
example of not changing the state is SELECT.
the problem i think about not sanitizing is this
inside code
$word = $_GET['word'];
$query = "SELECT * FROM tbl_example WHERE name LIKE '%$word%'";
mysqli_query($query);
then the data you search is
testword%';DROP TABLE tbl_example; --
so final value of $query is
SELECT * FROM tbl_example WHERE name LIKE '%testword%';DROP TABLE tbl_example; -- %'
BUT i guess this wont work cause mysqli_query and mysql_query() can only execute single SQL statement.
Also if you sanitize $_GET then inside the database there is ' then you search ' will your search match the one in the DB?
Can you also show me examples of sql injection?