pznmynd Posted January 12, 2009 Share Posted January 12, 2009 Little problem with my login script, when i go to implement it into my template i get this error when i run the page, Apparently there is already a session? I have no sessions open until then i cant see this being a problem.. The script works fine in testing stage no errors and nothing has changed from testing to implementing just now i get this error any ideas? Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /usr/home/web/users/a0028977/html/const/temp/subnews.php:9) in /usr/home/web/users/a0028977/html/const/temp/subnews.php on line 52 Cut from Code, Line 52 is line 3 here. require_once("connect.php"); //database connection session_start(); <-- LINE 52!! // catch feild data varabiles $userid = $_POST['userid']; $password = $_POST['password']; $submitted = $_POST['submitted']; if ($userid && $password){ //////////////////////////////////////////////// $query = sprintf("SELECT * FROM users where user_name = '$userid' and user_password = '$password'"); $result = @mysql_query($query); $rowAccount = @mysql_fetch_array($result); /////////////////////////////////////////////// } if ($rowAccount){ $_SESSION['id'] = $rowAccount['user_id']; header("location: welcome.php"); exit; } elseif ($submitted){ echo "You dont exist.... Contact Admin"; } ?> Link to comment https://forums.phpfreaks.com/topic/140462-solved-cannot-send-session-cache-limiter-headers-already-sent/ Share on other sites More sharing options...
trq Posted January 12, 2009 Share Posted January 12, 2009 The error is saying that headers have already been sent. Make sure that session_start() appears before any output is sent to the browser. This inludes any whitespace. Link to comment https://forums.phpfreaks.com/topic/140462-solved-cannot-send-session-cache-limiter-headers-already-sent/#findComment-735091 Share on other sites More sharing options...
pznmynd Posted January 12, 2009 Author Share Posted January 12, 2009 Exerlent mate ty, Fixed it by removing the html that was before it just started the session at the very top of my page. Link to comment https://forums.phpfreaks.com/topic/140462-solved-cannot-send-session-cache-limiter-headers-already-sent/#findComment-735093 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.