Re: Cookies

From: Date: Wed, 14 Feb 2001 04:35:29 +0000
Subject: Re: Cookies
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-39580@lists.php.net to get a copy of this message
when the cookie is not set, the $HTTP_COOKIE_VARS will not have an index 'getdwgnum' maybe you should try it this way <?php $cook = mt_rand (5, 50000) ; if isset($HTTP_COOKIE_VARS["getdwgnum"])) $cookieinfo = $HTTP_COOKIE_VARS["getdwgnum"]; } if ($cookieinfo > "") { $str = "where Cook = $cookieinfo"; $cx=odbc_pconnect("doc","",""); } else setcookie ("getdwgnum", $cook,time()+28800); ?> this code is not checked by executing. but I guess this should be the reason. hope that helps best regards Ankur Verma HCL Technologies A1CD, Sec -16 Noida, UP India. "Gary" <gcooke@radionics.com> wrote in message news:96bo38$1j7$1@toye.p.sourceforge.net... > I am getting the following error message from the code below. > > Warning: Undefined index: getdwgnum in d:\apache\htdocs/getdwgnum.php on > line 4 > > > <?php > > $cook = mt_rand (5, 50000) ; > $cookieinfo = $HTTP_COOKIE_VARS["getdwgnum"]; > if ($cookieinfo > "") > { > $str = "where Cook = $cookieinfo"; > $cx=odbc_pconnect("doc","",""); > } > else > setcookie ("getdwgnum", $cook,time()+28800); > > ?> > > > I want to look for a cookie and if it is not there I want to set one. Any > ideas? > > Thanks, Gary > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#39580) next »