i have weird condition php script.
$qtype = filter_input(input_get, 'qtype', filter_sanitize_number_int); if ($qtype == 1) { .. elseif ($qtype == 3) { $prod = filter_input(input_get, 'prod', filter_sanitize_string, filter_flag_no_encode_quotes); echo "prod = " . $prod; if ($prod == "sihy") $strsql = "select * dbo.table_s"; else $strsql = "select * dbo.table_fl"; .. } echo $strsql;
i called way:
http://localhost/new.php?qtype=3&prod="sihy"
and returns from dbo.table_fl. when put condition != , put table_fl on top, returns from dbo.table_s -> second $strsql value setting.
what happened? doing wrong? seems if not working.
thanks in advance, :rherry
i suspect passing quotation marks.
so either change condition to
if ($prod == "\"sihy\"")
or change url to
http://localhost/new.php?qtype=3&prod=sihy
Comments
Post a Comment