sanderphp Posted May 5, 2008 Share Posted May 5, 2008 I use the $_SESSION['login_id'] to determine which user is logged in so I can write an ID to the table. The previous page uses session_start () and $rider_id = $_SESSION['login_id']; In order to use the login_id again on a 3rd page, do I need to do anything differently? I'm not returning any results with the following. $rider_id = $_SESSION['login_id']; $sql="SELECT * FROM `".$tablename."` WHERE rider_id = '$rider_id'"; Quote Link to comment Share on other sites More sharing options...
947740 Posted May 6, 2008 Share Posted May 6, 2008 You have to start the session on the second page, too. Quote Link to comment Share on other sites More sharing options...
sanderphp Posted May 6, 2008 Author Share Posted May 6, 2008 Ok, that worked but also gave me this error: Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/sanderan/public_html/php/cycling/submit_success.php:9) in /home/sanderan/public_html/php/cycling/submit_success.php on line 10 I googled this error and found that you can't have anything above the session_start() but I don't think I do. Is it something else? <html> <head> <title>Cycling Stats</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link rel="stylesheet" type="text/css" href="style.css"/> </head> <table> <?php session_start(); $databasename='sanderan_cycling'; // Name of the database Quote Link to comment Share on other sites More sharing options...
dezkit Posted May 6, 2008 Share Posted May 6, 2008 the session start has to be above all javascript, html, php, perl, cgi, c++, java, 1337speak, etc... like so <?php session_start(); ?> <html> <head> <title>Cycling Stats</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link rel="stylesheet" type="text/css" href="style.css"/> </head> <table> <?php $databasename='sanderan_cycling'; // Name of the database Quote Link to comment Share on other sites More sharing options...
atravotum Posted May 6, 2008 Share Posted May 6, 2008 Session start needs to be at the top of the page Quote Link to comment Share on other sites More sharing options...
sanderphp Posted May 6, 2008 Author Share Posted May 6, 2008 ah... I never knew you could have multiple <?php> sets in a page. Thanks!!!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.