Login error with SESSION! Help

Ok I got this new problem while hosting my php files in a server which never happened while i worked in wamp. its a simple user registration & login form. Registration part is alright, but I cannot login properly, whenever I login it shows up the following error along with the welcome message:

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/foodecrp/public_html/beta3/login.php:5) in /home/foodecrp/public_html/beta3/login.php on line 7

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/foodecrp/public_html/beta3/login.php:5) in /home/foodecrp/public_html/beta3/login.php on line 7[/I]
Welcome! Click here to enter the MEMBER’S page

When I click “Click here”, the members page says “You need to be logged in”, this error never came up in WAMP! Please help!

Code for Login.php



$username = $_POST['username'];<-----Line 7
$password = $_POST['password'];

if ($username&&$password)

include "config.php";

$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 ($username==$dbusername&&md5($password)==$dbpassword)
			echo "Welcome! <a href='member.php'>Click here</a> to enter the MEMBER'S page";
			echo "Incorrect Password!";
	die("That user doesn't exist!");

	echo("Please enter and username and a password!");

Code for Member.php


if ($_SESSION['username'])
	echo "Welcome, ".$_SESSION['username']."!<br><a href='logout.php'>Log out</a><br><a href='changepassword.php'>Change password</a>";
		die("You must be logged in!");


Byte Order Marks (BOM) at the start of a file can often be a cause of that error. It’s basically caused by any output (even a space being output). As soon as you start sending output, headers will get sent.

Check whatever file calls login.php for a BOM or any output that is being sent before login.php calls session_start()

Thanks bt I didn’t understand what u said, sry
my index.php file is below which gets to login.php when a user tries to login…Could u please explain more & yeah do I have to put $_SESSION anywhere here?


		<form action='login.php' method='POST'>
			Username:<input type='text' name='username'><br>
			Password: <input type='password' name='password'><br>
			<input type='submit' value='Log in'>
		<a href='register.php'>Register</a>