| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| DesignersTalk > session problems desperately seeking solution ! |
|
LinkBack | Thread Tools | Search this Thread |
|
|
#1 (permalink) |
|
Registered User
Join Date: Apr 2004
Posts: 7
|
Hi, I am having a huge Session problem. I know that after a user is loged in thats where the session begins to start. I do update the DB so that I insert the session_id() to the data record where the user id is set. Then I know the session starts because I see in the browser that the PHPSESID is attached to the site I apply. However I donīt see that on every site I apply. I even donīt know if I have to see the PHPSESID is attached. I have to admit I have never worked with sessions. There is a search routine in my project where the user can select a link whether the user wants to search a customer by company or by first name or by last name. After the selection the user now can typ in the term to search for. The result of that search will be created as a link where the user only can see the first name and the last name of the customer for more details the user then can select the link he want to where the detail.php is called and the details of the customer is shown. This is where the problem starts. To recognize wich customer is selected I attache the .$row['ID']. to the detail.php . And on the detail.php I form the sql query by .$_REQUEST['rid']. (see code below) select.php : <?php while ($row =mysql_fetch_assoc($result)): echo("<a href=\"detail.php?rid=".$row['ID']."\">".$row['fname']." ".$row['lname']."</a>"); endwhile; } ?> detail.php: <?php $sql = "select customers.fname, customers.lname, customers.number, customers.email, company.name, city.name from customers,company,city where customers.companyID=company.ID AND customers.cityID=city.ID AND customers.ID='" .$_REQUEST['rid']. "'"; $result = mysql_query($sql); ?> Somehow I do get the details shown but I also get the following Warnings. - Warning: session_start(): Cannot send session cookie- headers already sent by (output started at W:\www.detail.php:1) in W:\www.detail.php on line 2 - Warning: session_start(): Cannot send session cache limiter- headers already sent by (output started at W:\www.detail.php:1) in W:\www.detail.php on line 2 - Warning: session_start(): Cannot modify header information- headers already sent by (output started at W:\www.detail.php:1) in W:\www.detail.php on line 2 line 2 is where session_start() is located. Can some php guru please help me ? |
|
|
|
|
|
#2 (permalink) |
|
I Ain't Losing Any Sleep
Join Date: Apr 2003
Posts: 5,236
|
I've been out for beers and just reading that gave me a headache. You have to start your sessions before anything else on the page. Are you doing that? That's fuckin' ingenious, if I understand it correctly. It's a Swiss fuckin' watch.
|
|
|
|
#3 (permalink) | |
|
vague
Join Date: Mar 2004
Location: Glasgow
Posts: 5,193
|
Quote:
he can't be, else the headers wouldn't have been sent already. in the file with session_start, ensure it's the first thing listed, and also make sure this file isn't been included in another file (hence the 'headers already sent' malarky). this is by far the most common problem encountered with sessions - try googling a bit too |
|
|
|
|
#4 (permalink) | |
|
I Ain't Losing Any Sleep
Join Date: Apr 2003
Posts: 5,236
|
Quote:
That's fuckin' ingenious, if I understand it correctly. It's a Swiss fuckin' watch.
|
|
|
|
|
#7 (permalink) | |
|
Registered User
Join Date: Apr 2004
Posts: 7
|
Quote:
Funy but somehow I donīt get those warnings anymore. What I did is Iīve rechecked every singl file I use in my project and removed any possible whitespace that eventually would cause a problem. But I am still not sure if there is a session restart or a new session start or not, refered to .. echo("<a href=\"detail.php?rid=".$row['ID']."\">".$row['fname']." ".$row['lname']."</a>"); ... ???? |
|
|
![]() |