marcus Posted November 30, 2006 Share Posted November 30, 2006 I'm just making a login for my friend using sessions, but I can't seem to get the sessions to register[code]<?php ob_start();<?phpsession_start(); $sql = "SELECT * FROM account WHERE name='$_POST[name]' AND pass='$_POST[pass]'"; $result = mysql_query($sql); $num = mysql_num_rows($result); if ($num > 0) { $id = mysql_fetch_assoc($result); // ### USER AND PASSWORD ARE CORRECT $_SESSION[auth] = "yes"; $_SESSION[name] = "$_POST[name]"; $_SESSION[id] = "$id[id]"; header("Location: ?content=news"); }else{ // ### USER OR PASSWORD IS INCORRECT header("Location: ?content=failed"); }?><?php ob_end_flush(); ?>[/code] Link to comment https://forums.phpfreaks.com/topic/29043-session-help/ Share on other sites More sharing options...
piznac Posted December 1, 2006 Share Posted December 1, 2006 Why do you have the <?php tags twice?[code]<?php ob_start();<?phpsession_start();[/code]try just this:[code]<?php ob_start();session_start();[/code]or close the other one out like this:[code]<?php ob_start(); ?><?phpsession_start();[/code] Link to comment https://forums.phpfreaks.com/topic/29043-session-help/#findComment-133075 Share on other sites More sharing options...
marcus Posted December 1, 2006 Author Share Posted December 1, 2006 That didn't change anything :) Link to comment https://forums.phpfreaks.com/topic/29043-session-help/#findComment-133076 Share on other sites More sharing options...
piznac Posted December 1, 2006 Share Posted December 1, 2006 Ok well that was my shot in the dark :) Link to comment https://forums.phpfreaks.com/topic/29043-session-help/#findComment-133077 Share on other sites More sharing options...
marcus Posted December 1, 2006 Author Share Posted December 1, 2006 I fixed that error, haha. Link to comment https://forums.phpfreaks.com/topic/29043-session-help/#findComment-133080 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.