Jump to content

Php And Mysql

subha rr

Recommended Posts

Hi...below the php code for user login details<?phpinclude "pass.php";session_start();$user = isset($_POST['user']) ? $_POST['user'] : $_SESSION['user'];$pass = isset($_POST['pass']) ? $_POST['pass'] : $_SESSION['pass'];mysql_query("insert into login('', '$user', '$pass')");$a = mysql_connect("localhost", "time", "");if($a){ $db = mysql_select_db("time", $a);}if(!isset($pass)){?> <form method=POST action=""> <div align=center >Enter login details</div><br> <table align = center> <tr><td>Username</td><td><input type=text name=user value=""> <tr><td>Password</td><td><input type=password name=pass value=""> <tr><td><input type=submit value="Submit"></td></tr> </table> </form><?php}$user = $_SESSION['user'];$pass = $_SESSION['pass'];$sql = "select * from login where username = '$user' and password = password('$pass')";$result2 = mysql_query($sql);if(mysql_num_rows($result2)){ echo "Authentication Failed";}?>Error will be occuredWarning: mysql_connect(): Can't connect to MySQL server on 'localhost' (10061) in d:\time schedule\admin\myauth.php on line 8Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in d:\time schedule\admin\myauth.php on line 33what is the issue for that?Pls give a correct php code......Regardssubha

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...