my query written in php is:
$sql="SELECT * FROM ".TABLE_PREFIX."login WHERE username ='".$username."'
AND password='".$password."'";
$res_id = mysql_query($sql);
$num_rows = mysql_num_rows($res_id);
echo $num_rows;
When i enter a valid user name and password from a form it works ok.
When i input some sql injection code the query output is:
SELECT * FROM form_login WHERE username ='' or '1'='1' AND password='' or '1'='1'
Which is a valid sql statement.But it gives an output(ie number of rows) as 0(zero).
If I write the same output sql statement in the program itself as-
$sql="SELECT * FROM form_login WHERE username ='' or '1'='1'
AND password='' or '1'='1'";
it works fine and it gives some result(for eg 3).
How can i get the correct result by inputing the sql injection code?