-5

Folloing code. I have Parse error:

syntax error, unexpected '>' in C:\xampp\htdocs\login.php on line 54

here script <script>window.open('welcome.php','_self')</script> line is that line.

<?php
mysql_connect("localhost","root","secret");
mysql_select_db("users_db");

if(isset($_POST['login'])){
    $password=$_POST['pass'];
    $email=$_POST['email'];
    $check_user="SELECT * from users WHERE user_pass='$password' AND user_email='$email';
    $run=mysql_query($check_user);
    if(mysql_num_rows($run)>0){
        echo "<script>window.open('welcome.php','_self')</script>";
    }else{
        echo "<script>alert('Email or password is incorrect!')</script>";
    }   
}
?>
Rajdeep Paul
  • 16,887
  • 3
  • 18
  • 37
k.b
  • 157
  • 1
  • 2
  • 13
  • 5
    Java is to Javascript as Ham is to Hamster – Reimeus Nov 13 '16 at 15:13
  • Hi, maybe you could show us your source code, after some greetings :) – Max Nov 13 '16 at 15:15
  • 1
    `$check_user="SELECT * from users WHERE user_pass='$password' AND user_email='$email';` => `$check_user="SELECT * from users WHERE user_pass='$password' AND user_email='$email'";` – Max Nov 13 '16 at 15:21
  • 1
    You didn't close your quotes. You should learn the language syntax before posting this kind of errors :) – Max Nov 13 '16 at 15:23
  • Do you see how Stack Overflow's syntax highlighting makes the issue obvious? It's a good idea to use a text editor or IDE that provides the same feature. – ChrisGPT was on strike Nov 13 '16 at 15:48
  • Aside: Please don't write new code using PHP's `mysql_*` functions. They were deprecated in PHP 5.5, which is so old it no longer even receives security updates, and completely removed in PHP 7. Use PDO or `mysqli_*` instead. See https://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php for details. – ChrisGPT was on strike Nov 13 '16 at 15:49

1 Answers1

0

You are missing a double quote " at the end of following line of your code.

$check_user="SELECT * from users WHERE user_pass='$password' AND user_email='$email';