pro_php thread: making sql queries safe
Personally, I think that the best way to make SQL queries safe is to guarantee
that they are assembled "safely", not to accept them from any untrusted source
and try to "safe-ify" them.
addslashes() should be perfectly capable of ensuring the safety of your query:
$where_clause = "WHERE col_x = '" . addslashes($untrusted_text) . "'"
. " AND col_y = '" . addslashes($more_unsafe_txt) . "'";
Take care,
Nik
|





