Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_php thread: making sql queries safe


Message #1 by "Vincent, Justin" <J.Vincent@e...> on Tue, 17 Dec 2002 11:01:57 -0000
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


  Return to Index