Jump to content

[SOLVED] PHP login code errors


rocket01

Recommended Posts

Guys I have recently been creating a login page for my website, and i'm not exactly an expert at this.  I have been having an error showing during testing of the code and i was wondering could anyone point me in the right direction.  The error is:

 

Parse error: syntax error, unexpected T_IF in C:\xampp\htdocs\login.php on line 17

 

The Code is:

 

<?php

 

 

$username = $_POST['username'];

$password = $_POST['password'];

 

if ($username&&$password)

{

 

$connect = mysql_connect("localhost","root","") or die ("failed");

mysql_select_db("phplogin") or die ("failed");

 

$query = mysql_query("SELECT * FROM users WHERE username='$username'");

 

$numrows = mysql_num_rows($query)

 

if ($numrows!=0)

{

 

while ($row = mysql_fetch_assoc($query))

{

$dbusername = $row['username'];

$dbpassword = $row['password'];

}

 

// check to see if they match!

if ($dbusername==$dbusername&&dbpassword==dbpassword)

{

echo "you're in";

}

else

echo "incorrect password!";

 

}

else

die ("No!");

 

 

 

}

else

die ("Please Enter a Username and Password");

 

?>

 

Any help would be much appreciated.

 

PS the line 17 that is showing the error is highlighted in blue

Link to comment
https://forums.phpfreaks.com/topic/176775-solved-php-login-code-errors/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.