RE: [PHP] Re: Cookie array

2002-08-11 Thread Maxim Maletsky

It is way smarter storing serialized array in one cookie. And, if you
get length problems then only store SESSID in cookie and the rest in
session or database.


Sincerely,

Maxim Maletsky

PHP Beginner
www.phpbeginner.com


> -Original Message-
> From: B.C. Lance [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, August 11, 2002 6:11 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Re: Cookie array
> 
> to store:
> 
> setcookie ("TestCookie[0]", "zero", time() + 3600);
> setcookie ("TestCookie[1]", "one", time() + 3600);
> setcookie ("TestCookie[2]", "two", time() + 3600);
> 
> or
> 
> setcookie ("TestCookie[one]", "1", time() + 3600);
> setcookie ("TestCookie[two]", "2", time() + 3600);
> setcookie ("TestCookie[three]", "3", time() + 3600);
> 
> 
> to retrieve:
> 
> foreach($_COOKIE["TestCookie"] as $key => $value) {
>echo "{$value}";
> }
> 
> or
> 
> echo $_COOKIE["TestCookie"]["one"];
> echo $_COOKIE["TestCookie"][1];
> 
> 
> Jan - Cwizo wrote:
> > Hi !
> >
> > How can I stoor array in to a cookie ?
> >
> > Do I just define an array and stoore it in a cookie ?
> > How do I access the data in the array then ?
> >
> >
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Re: Cookie array

2002-08-11 Thread Jan - CWIZO

Thanx !

Dne nedelja 11. avgust 2002 18:10 je B.C. Lance napisal(a):
> to store:
>
> setcookie ("TestCookie[0]", "zero", time() + 3600);
> setcookie ("TestCookie[1]", "one", time() + 3600);
> setcookie ("TestCookie[2]", "two", time() + 3600);
>
> or
>
> setcookie ("TestCookie[one]", "1", time() + 3600);
> setcookie ("TestCookie[two]", "2", time() + 3600);
> setcookie ("TestCookie[three]", "3", time() + 3600);
>
>
> to retrieve:
>
> foreach($_COOKIE["TestCookie"] as $key => $value) {
>echo "{$value}";
> }
>
> or
>
> echo $_COOKIE["TestCookie"]["one"];
> echo $_COOKIE["TestCookie"][1];
>
> Jan - Cwizo wrote:
> > Hi !
> >
> > How can I stoor array in to a cookie ?
> >
> > Do I just define an array and stoore it in a cookie ?
> > How do I access the data in the array then ?

-- 
LP
CWIZO
www.3delavnica.com
www.ks-con.si
www.WetSoftware.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: Cookie array

2002-08-11 Thread B.C. Lance

to store:

setcookie ("TestCookie[0]", "zero", time() + 3600);
setcookie ("TestCookie[1]", "one", time() + 3600);
setcookie ("TestCookie[2]", "two", time() + 3600);

or

setcookie ("TestCookie[one]", "1", time() + 3600);
setcookie ("TestCookie[two]", "2", time() + 3600);
setcookie ("TestCookie[three]", "3", time() + 3600);


to retrieve:

foreach($_COOKIE["TestCookie"] as $key => $value) {
   echo "{$value}";
}

or

echo $_COOKIE["TestCookie"]["one"];
echo $_COOKIE["TestCookie"][1];


Jan - Cwizo wrote:
> Hi !
> 
> How can I stoor array in to a cookie ?
> 
> Do I just define an array and stoore it in a cookie ?
> How do I access the data in the array then ?
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: Cookie array

2002-08-10 Thread Lee Doolan

> "Jan" == Jan  <[EMAIL PROTECTED]> writes:

Jan> Hi !  How can I stoor array in to a cookie ?

Jan> Do I just define an array and stoore it in a cookie ?  How do
Jan> I access the data in the array then ?

you can use serialize() / unserialize() but be careful because the
amount of storage allowed in a cookie is limited.  what i do is to
store thing like serialized arrays and serialized objects in a database
table indexed by the session id.


-- 
Flowers of morning glory.  +-+
The sky above this street  |donate to causes I care about:   |
Begins to overcast.|  http://svcs.affero.net/rm.php?r=leed_25|
   --Sugita+-+

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php