RobLamb Posted December 4, 2009 Share Posted December 4, 2009 Hi Everyone I am having a problem with some session variables. Basically I am setting them based on fields in a form, then I need to use them for an update query in another page. If I view all the variables set, I can see them, but they are not coming through in my code where I need them. Print out of page where I am checking them. (The two i need are frPrefixTwo and frNoTwo) Please help urgent;y on this guys!! I am really stuck. ses1: ses2: SELECT stockId FROM tblstock WHERE stockEnginePrefix = '' AND stockFrameNo = '' Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\clubYamaha2\step5mark.php:36) in C:\xampp\htdocs\clubYamaha2\step5mark.php on line 45 Array ( [KT_lastsiteroot] => 93bf5b3b77be8647f2b4b5e7332e7273 [frPrefix] => 3gx [frNo] => 110194 [title] => Mr [firstName] => a [surname] => b [TelHome] => [TelWork] => [TelCell] => [iDNo] => 730710524869 [frPrefixTwo] => 3gx [frNoTwo] => 110194 [yamType] => 3 [yamUse] => 17 [yamReg] => [yamPurch] => 1 [stockId] => ) <code> $colname_rsStockId = $_SESSION['frPrefixTwo']; $col2_rsStockId = $_SESSION['frNoTwo']; echo "ses1: ".$_SESSION['frPrefixTwo']."<br/>"; echo "ses2: ".$col2_rsStockId."<br/>"; mysql_select_db($database_conYamaha, $conYamaha); $query_rsStockId = sprintf("SELECT stockId FROM tblstock WHERE stockEnginePrefix = '".$colname_rsStockId."' AND stockFrameNo = '".$col2_rsStockId."'"); echo $query_rsStockId; $rsStockId = mysql_query($query_rsStockId, $conYamaha) or die(mysql_error()); $row_rsStockId = mysql_fetch_assoc($rsStockId); $totalRows_rsStockId = mysql_num_rows($rsStockId); session_start(); $_SESSION['stockId'] = $row_rsStockId['stockId']; session_start(); Print_r ($_SESSION); </code> Link to comment https://forums.phpfreaks.com/topic/183946-session-issues-not-showing/ Share on other sites More sharing options...
rajivgonsalves Posted December 4, 2009 Share Posted December 4, 2009 your session_start() should be the first thing you initialize in the script, that will start the session and give you access to the session vars Link to comment https://forums.phpfreaks.com/topic/183946-session-issues-not-showing/#findComment-971028 Share on other sites More sharing options...
RobLamb Posted December 4, 2009 Author Share Posted December 4, 2009 Hi Ravi I do this on the page before. session_start(); set all my session variables run some scripting (use the 2 I need to run one set of script commands here) redirerct to next page variables then come out empty Link to comment https://forums.phpfreaks.com/topic/183946-session-issues-not-showing/#findComment-971033 Share on other sites More sharing options...
bbaker Posted December 4, 2009 Share Posted December 4, 2009 session_start(); needs to be on EVERY pages where you are setting or retrieving session variables Link to comment https://forums.phpfreaks.com/topic/183946-session-issues-not-showing/#findComment-971036 Share on other sites More sharing options...
RobLamb Posted December 4, 2009 Author Share Posted December 4, 2009 Thanks bbaker! A lot of time that wasted for me!!!!!! THANKS! Link to comment https://forums.phpfreaks.com/topic/183946-session-issues-not-showing/#findComment-971038 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.