Is this a issue with register _globals = off.  try referencing it with
Also isn't 3600 only an hour.  60secs * 60mins?  i think 6 weeks would
be...  151200  60 * 60 * 42days
does that work?


                    Terry Romine                                                       
                    <eatrom@blazing-t       To:     [EMAIL PROTECTED]               
          >              cc:                                        
                                            Subject:     [PHP-DB] cookies multiple 
                    07/03/2002 10:45                                                   

I'm having a problem with cookies over several pages. I've tried to set
them up per the manual, ie: prior to header, and using
setcookie('cookiename',$value,time()+3600). The cookie seems to be
created fine on the first page, and passed to the second page, but is
not maintained when the pages are re-viewed.

I am trying to use this to assign a user id when someone comes in, and
keep their id while they go through various searches and resulting
pages, as well as keeping their search parameters for them. But when
they go to a new search, all the data gets wiped and it starts all over.

I have the cookie set for an hour, but it is empty when the search is
run again. I thought cookies would remain in effect for the duration of
the life (an hour) and be accessible to the pages over again.


My code is as follows:

 if (!isset($user_data)) {
  setcookie("user_data","",time()+(3600));    // set for 6 weeks *24*7*6
 if($user_data=="") {
  $sql="insert into user (last_login) values (now())";
  $myID= mysql_insert_id();
  $user_data = $myID;

 if (isset($user_data)) { $myID = $user_data; }

PHP Database Mailing List (
To unsubscribe, visit:

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to