Bluehost.com Web Hosting $6.95

Re: Anyone for cookies and milk? :-)

This is a discussion on Re: Anyone for cookies and milk? :-) within the PHP General forums, part of the PHP Programming Forums category; "Ryan A" <ryan@jumac.com> a écrit dans le message de news: 000701c34bdf$efb850d0$d42a053e@l2zcaxu7emppqh... &...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 07-16-2003
Nomadeous
 
Posts: n/a
Default Re: Anyone for cookies and milk? :-)

"Ryan A" <ryan@jumac.com> a écrit dans le message de news:
000701c34bdf$efb850d0$d42a053e@l2zcaxu7emppqh...
> Hey,
> Am just getting into PHP cookies and have gotten a problem...(surprise
> surprise)
>
> Am trying to set a basic cookie to see exactly how things work before I
> start using it in my apps, heres the code i am using:
> (SetCookieEx.php)
> <?php
> setcookie("name1","1","","",".bestwebhosters.com") ;
> setcookie("name2","1","","",".bestwebhosters.com") ;
>
> echo "done";
> ?>
>
> This is the output I am getting:
> **********************
> Warning: setcookie() expects parameter 3 to be long, string given in
> /bestweb/public_html/testing/SetCookieEx.php on line 2
>
> Warning: setcookie() expects parameter 3 to be long, string given in
> /bestweb/public_html/testing/SetCookieEx.php on line 3
> done


Those errors appear because you out "" in the third parameter of the
setcookie function.
The parser expects a long (or an integer if you prefer ;-) )
This parameter is used to affect the life of the cookie, put 215000, for a
one hour cookie.

Thanks for the milk :-)

>
> This is how I am trying to read the cookies: (ReadCookieEx.php)
> ****************************
> <?php
> if (isset($_COOKIE ['name1'])){
> echo $_COOKIE ['name1'];
> }else{echo "wrong1";}
>
> if (isset($_COOKIE ['name2'])){
> echo $_COOKIE ['name2'];
> }else{echo "wrong2";}
> ?>
>
> This is the output i am getting:
> *******************
> wrong1wrong2
>
>
>
> Anybody have any ideas?
>
> Cheers,
> -Ryan
>



Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 07:23 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0