Need help
Fatal error: Uncaught Error: Call to undefined function mysql_real_escape_string() in C:\xampp\htdocs\login\process.php:9 Stack trace: #0 {main} thrown in C:\xampp\htdocs\login\process.php on line 9
code:
<?php
//GeT values passe from form in login.php file
$username = $_POST['user'];
$password = $_POST['pass'];
// to prevent mysql injection
$username = stripcslashes($username);
$password = stripcslashes($password);
$username = mysql_real_escape_string($username);
$password = mysql_real_escape_string($password);
//connect to the server and select database
mysql_connect("localhost","root", "");
mysql_select_db("login");
//Query the database for user
$result = mysql_query("select * from users where username = '$username' and password = '$password'")
or die ("failed to query database" .mysql_error());
$row = mysql_fetch_array($result);
if ($row['username'] == $username && $row['password'] == $password ){
echo "Wait ! You are about to Log in" .$row['username'];
} else {
echo "Username or Password Incorect!";
}
?>
Fatal error: Uncaught Error: Call to undefined function mysql_real_escape_string() in C:\xampp\htdocs\login\process.php:9 Stack trace: #0 {main} thrown in C:\xampp\htdocs\login\process.php on line 9
code:
<?php
//GeT values passe from form in login.php file
$username = $_POST['user'];
$password = $_POST['pass'];
// to prevent mysql injection
$username = stripcslashes($username);
$password = stripcslashes($password);
$username = mysql_real_escape_string($username);
$password = mysql_real_escape_string($password);
//connect to the server and select database
mysql_connect("localhost","root", "");
mysql_select_db("login");
//Query the database for user
$result = mysql_query("select * from users where username = '$username' and password = '$password'")
or die ("failed to query database" .mysql_error());
$row = mysql_fetch_array($result);
if ($row['username'] == $username && $row['password'] == $password ){
echo "Wait ! You are about to Log in" .$row['username'];
} else {
echo "Username or Password Incorect!";
}
?>