Originally posted by Natty_Dreadlock
hi,
so it seems the first problem was caused by some encoding or whitespace issue. Concerning your second question, u should first try to remove $b = new hitch_basket() coz it's not necessary and might be a reason for your problem. Secondly, echo the content of the cookie and see whether it's valid or not. The docu at http://de2.php.net/manual/en/language.oop.serialization.php can give u other ideas what's wrong.
hth and if this does not solve your problem feel free to ask again.
I have read the help but I can save in a session without problem. The problem I got is only with Cookie :queasy:
Here is the complete code of my "example" that doesn't work.
<?php
require_once("inc.php");
if(isset($_COOKIE["basket"]))
{
echo("I see the cookie!<br>");
$b = unserialize($_COOKIE["basket"]);
if (is_object($b))
{
echo("I see an objet <br>");
$b->Afficher();
$b->Clear();
}//Fin du if
else
echo("I see a cookie but NO OBJECT");
}//Fin du if
else
{
$b = new hitch_basket();
$b->Ajouter("20-101",0,1);
setcookie("basket",serialize($b),time()+3600*24);//24h
echo("Enregistrer dans le cookie");
}//Fin du else
?>
Here is what I got a the web Server :
I see the cookie!
I see a cookie but NO OBJECT
Here is what I got on my localhost server :
I see the cookie!
I see an objet
Id : 20-101, Table : 0, Qte : 1
I have open both cookie (web server and my localhost) and they look quite the same (except the url)...
So I guess that the way it saves the stuff is alright and the way it try to restore the data isn't alright :\
I need that to work, I will try to do a run with it, thx to help me bro, we should be near of the solution.
Daok