Note that there are some explanatory texts on larger screens.

plurals
  1. POCannot redirect to home page
    text
    copied!<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/2243087/warning-cannot-modify-header-information-headers-already-sent">Warning: Cannot modify header information - headers already sent</a><br> <a href="https://stackoverflow.com/questions/8028957/headers-already-sent-by-php">Headers already sent by PHP</a> </p> </blockquote> <blockquote> <p>Error: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\GameHutWebsite\data\connection.php:1) in C:\xampp\htdocs\GameHutWebsite\login.php on line 21</p> </blockquote> <p>I am getting this error when the user enters the correct username and password in the login screen to send the user in the home page. This is the code:</p> <pre><code>&lt;?php if ($_POST) { $dsLogin = $dataobj-&gt;validateLogin($_POST["txtUsername"],$_POST["txtPassword"]); if (mysql_num_rows($dsLogin)) { $dsUserDetails = mysql_fetch_array($dsLogin); $_SESSION["UserEmail"] = $dsUserDetails["UserEmail"]; $_SESSION["Username"] = $dsUserDetails["Username"]; $_SESSION["UserTypeId"] = $dsUserDetails["UserTypeId"]; header ("Location: index.php"); } else { $msg = "Invalid Username and Password!"; } } ?&gt; </code></pre> <p>Connection Class:</p> <pre><code>&lt;?php class connection { function connect($sql) { $server = 'localhost'; $myDB = 'gamehutdb'; //connection to the database $dbhandle = mysql_connect($server, 'root', "") or die("Couldn't connect to SQL Server $server"); //select a database to work with $selected = mysql_select_db($myDB) or die("Couldn't open database $myDB"); //execute the SQL query and return records $result = mysql_query($sql); //return result set return $result; //close the connection mysql_close($dbhandle); } } ?&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload