php - If made a login page for Mysql but it gives Parse error -



php - If made a login page for Mysql but it gives Parse error -

i made database called login table called users. says parse error, line 68

here's code:

<?php $host ='localhost'; $user = 'root'; $pass ='' ; $db = 'login'; mysql_connect($host, $user, $pass); mysql_select_db($db); if(isset($_post ['username'])) { $username = $_post['username']; $password = $_post['password']; $sql = "select * users username='".$username."' , password='".$password."' limit 1"; $res = mysql_query($sql); if (mysql_num_rows($res) == 1) { echo "you logged in"; exit(); } else { echo "password or username wrong. please seek again"; exit(); } ?> <html> <head> <title> login </title> </head> <body> <form method='post' action='login.php'> <input type='text' name='username' value="" /> <input type='password' name='password' value=''/> <input type='submit' name='submit ' value='log in' / > </form> <?php $username = "theasher"; $password = "theasher"; $hostname = "localhost"; //connection database $dbhandle = mysql_connect($hostname, $username, $password) or die("unable connect mysql"); echo "connected mysql<br>"; ?> </body> </html>

you not close if (isset($_post ['username'])) { status }

<?php $host = 'localhost'; $user = 'root'; $pass = ''; $db = 'login'; mysql_connect($host, $user, $pass); mysql_select_db($db); if (isset($_post ['username'])) { $username = $_post['username']; $password = $_post['password']; $sql = "select * users username='" . $username . "' , password='" . $password . "' limit 1"; $res = mysql_query($sql); if (mysql_num_rows($res) == 1) { echo "you logged in"; exit(); } else { echo "password or username wrong. please seek again"; exit(); } } ?> <html> <head> <title> login </title> </head> <body> <form method='post' action='login.php'> <input type='text' name='username' value="" /> <input type='password' name='password' value=''/> <input type='submit' name='submit ' value='log in' / > </form> <?php $username = "theasher"; $password = "theasher"; $hostname = "localhost"; //connection database $dbhandle = mysql_connect($hostname, $username, $password) or die("unable connect mysql"); echo "connected mysql<br>"; ?> </body> </html>

php mysql login

Comments

Popular posts from this blog

c - Compilation of a code: unkown type name string -

ubuntu - Bash Script to Check That Files Are Being Created -

Php operator `break` doesn't stop while -