I'm writing an authentication system for my site and I want to ensure I'm protected against SQL injection. I'm using 'mysql_real_escape_string' but this clears out the string completely. the username is something like 'Damo' but after running through the function it's gone.
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"));