I am writing an authentication system for my site, and I want me to be protected from SQL injection. I use 'mysql_real_escape_string', but this completely clears the line. the username is something like "Damo", but after the function has completed, it disappeared.
What am I doing wrong? (it works fine without mysql_real_escape_string)
$user_name = $_POST["username"];
$md5 = md5($_POST["password"]);
$user_name = mysql_real_escape_string($user_name);
$login = $query->GetSingleQuery("--SINGLE","SELECT user_name, id FROM url_users WHERE user_name='".$user_name."' and user_password='".$md5."';",array("user_name","id"));
source
share