real_escape help

hey i need help with a login/register page. im having trouble on how to use the mysql_real_escape_string.
i’ve followed like 3 tuts already and it hasnt worked. here’s the code for the login. and yes all the post stuff is correct i didnt misspell anything.

$con = mysql_connect("mysql.x10hosting.com", "kishou", "password");
if (!$con)
{
die('Couldnt connect to Database' );
}
mysql_select_db("kishou", $con);
$username = mysql_real_escape_string($_POST['username']);
$password = mysql_real_escape_string($_POST['password']);
$result = mysql_query("SELECT * FROM registered_members");
$row = mysql_fetch_array($result);
if ($username==$row[ 'username']&&$password==$row[ 'Password'])
echo "Login successful";
else
die('Login failed');
mysql_close($con)

What exactly goes wrong? ‘It doesn’t work’ doesn’t help us understand your issue.
Are there any error messages, or warnings or so? If not, have you tried running the script with ‘error_reporting(E_ALL);’?
See also the link in my signature for debugging help.

Sponsor our Newsletter | Privacy Policy | Terms of Service