hi guyz!
please help me in sorting out error as im unable to find it...
my requirement is there will be userid field and password field and "login" button after clicking button certain validations must be done whether he is an valid user or not (connect to database and check for valid user & password) if he is valid user he must login and goto another php file.....
im using winxp OS / XAMPP Windows Version 1.6.4 !
Problem: im getting errors im sending the errors & code plz sort out
[code=php]
<html>
<head>
<title>Untitl ed Document</title>
</head>
<body>
<?php
session_start() ;
//Connect to database
mysql_connect ( "localhost" , "root", "sunkalpid" )or die("Could not connect: ".mysql_error() );
mysql_select_db ("emp") or die(mysql_error ());
$username = $_POST['username'];
$password = md5($_POST['password']);
$query = "SELECT * FROM users WHERE username=’$user name’ and password=’$pass word’ ";
$result = mysql_query($qu ery);
if (mysql_num_rows ($result) != 1)
{
$error = "Bad Login";
include "login.html ";
} else {
$_SESSION['username'] = "$username" ;
include "registerdispla y.html";
}
?>
</body>
</html>
[/code]
looking forward ur help ASAP
Regards
Priya.
please help me in sorting out error as im unable to find it...
my requirement is there will be userid field and password field and "login" button after clicking button certain validations must be done whether he is an valid user or not (connect to database and check for valid user & password) if he is valid user he must login and goto another php file.....
im using winxp OS / XAMPP Windows Version 1.6.4 !
Problem: im getting errors im sending the errors & code plz sort out
Code:
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\sunkalpid\login.php:8) in C:\xampp\htdocs\sunkalpid\login.php on line 9 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\sunkalpid\login.php:8) in C:\xampp\htdocs\sunkalpid\login.php on line 9 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\sunkalpid\login.php on line 24
[code=php]
<html>
<head>
<title>Untitl ed Document</title>
</head>
<body>
<?php
session_start() ;
//Connect to database
mysql_connect ( "localhost" , "root", "sunkalpid" )or die("Could not connect: ".mysql_error() );
mysql_select_db ("emp") or die(mysql_error ());
$username = $_POST['username'];
$password = md5($_POST['password']);
$query = "SELECT * FROM users WHERE username=’$user name’ and password=’$pass word’ ";
$result = mysql_query($qu ery);
if (mysql_num_rows ($result) != 1)
{
$error = "Bad Login";
include "login.html ";
} else {
$_SESSION['username'] = "$username" ;
include "registerdispla y.html";
}
?>
</body>
</html>
[/code]
looking forward ur help ASAP
Regards
Priya.
Comment