I keep getting this error when I try to set a session variable:
Cannot send session cookie - headers already sent by ...
I know the session stuff has to be the first thing on the page and it is so I dont get it.. Code is below:
<?php
session_start();
include "globals.php";
$dbconn = mysql_connect("$server","$user","$pass");
$result = mysql_select_db("$db", $dbconn);
$sql = "SELECT * FROM login WHERE login='$login' AND password='$password'";
$result = mysql_query($sql);
if(mysql_num_rows($result)==0)
{
print "Invalid username or password.";
die();
}else{
$loggedin = "1";
session_register('loggedin');
}
?>
BTW: PHP is one of the most difficult languages to learn and its by far NOT user friendly, its driving me nutz. I have to ask questions about every stupid little thing I do in it but I am forced to use it. ARGH!.. Sorry, just venting..