0

Hey Guys n Gals,
I want to make login page in which I m taking email ID n password. If user enters email ID & password. Welcome.php should be open. else fail.php opens.Plz, read my attachments,
But I received following warnings.

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\wamp\www\webpage\index.php on line 15

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\wamp\www\webpage\index.php on line 16

Warning: Cannot modify header information - headers already sent by (output started at C:\wamp\www\webpage\index.php:15) in C:\wamp\www\webpage\index.php on line 26


Plz, tell me wt the prob.

Edited by Pooja J.: n/a

Attachments
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Fail</title>
</head>

<body>
<h1 align="center">Ooops! Bad email or password! Try again</h1>
</body>
</html>
<?php
	$con=mysql_connect("localhost","root","");
$db=mysql_select_db('webpage');
	//session_start();
	
	$submit=$_POST['submit']; 
	$email=$_POST['email'];
	$password=$_POST['password'];
	
	if(!empty ($submit))
	
	{	
		$query="select * from index where (email='$email' and password='$password')";
		$rs=mysql_query($query); 
		$row=mysql_fetch_array($rs);
		$count=mysql_num_rows($rs); 
		
		if($count > 0)
		{
			//session_start();
			   $_SESSION['email'] = $email; 
			   header("Location:welcome.php");  
		} 
		else
		{
			 header("Location:fail.php");
				 
		}
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Login4</title>
</head>

<body>
   	  		  <form id="loginform" name="loginform" method="post" action="index.php">
   	  		    Name<input name="email" type="text" id="email" />
                      Password<input name="password" type="password" id="password" />
                                        <input name="submit" type="submit" id="submit" value="submit" />
                    
              </form>
              </body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Welcome page</title>
</head>

<body>
<h1 align="center">Welcome to your personal account</h1>
</body>
</html>
3
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by Pooja J.
0

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\wamp\www\webpage\index.php on line 15

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\wamp\www\webpage\index.php on line 16

Make sure you have the correct details for the MYSQL database.

Warning: Cannot modify header information - headers already sent by (output started at C:\wamp\www\webpage\index.php:15) in C:\wamp\www\webpage\index.php on line 26

Only define 'session_start()' at the begging on the page, just after the opening tags and don't define it everytime you want to use it. You have it in multiple places.

0

first you must have database in mysql and then you must insert data into your database and finally you may get your datas. if you dont have database and table its not possible
Good luck
if any problems again feel free to respond

0

HI,
I have correct database, also I delete multiple session_start() function from code. But it doesn't work yet.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.