FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


[PHP] classes problem..





raver
ok so i want to be able to do this...

$obiect1=new clasa1;
$obiect2=new clasa2;
in the object
$obiect1->test();
i want to see $obiect2
and it doesn`t work with ;;


in another matter..
class{}
$obiect=new class;
$obiect->valoare=30;
session_start();

$_SESSION["$obiect"]=$obiect;
in script2.php
$obiect=$_SESSION["obiect"];
echo $obiect->valoare;
doesn`t echo...
and echo $obiect
it outputs obiect, and looses it`s value...

any help would be apreciated...and fast Smile
jasperlevink
where is your class definition of clasa1 and 2?

this can't be right: class { }

Grtz.
BlackSkad
Did you include the definition of the class again at the beginning of script2? Php needs it to handle the class...

Also your session-variable is wrong. When you want to set a session-value with the key obiect, it goes like this:
Code:
$_SESSION['obiect'] = $obiect;


In your code, you use the value of $obiect as key. As that is what you want to know, that session-var is in fact lost...

BlackSkad
raver
thanks blacksad... that was the problem.. i`ve included in the second script, but in a wrong way Smile
thanks again
Related topics
Php, mime_content_type() problem
php security problem
TYPO3, problem with innstall.
PHP Login Problem
What is useful way in this php+mysql problem?
problems for indexing php pages in google.
PHP OOP problem
PHP script problem
Stats problem - php execution problem (MOD Assist Required)
php msql problem
php mail(); problem... half fixed?
PHP noob problem
Favorite PHP Classes and Scripts
PHP Includes Problem
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.