sangoku Posted February 15, 2010 Share Posted February 15, 2010 hy again , :'( Have a bit of confusion here how do i call a function inside a class which should handle the class but not destroy it? i have the folowing problem some class which inside of it has a function which makes this class and manipulates it then updates some DB data and returns false or true but when i call this function from lets say $a = new class() $a-> theFunction(); it ends up destrozing the object... no return no tnohing in it but still destroys the damn object... My question is why dous the object get destroyed? Quote Link to comment https://forums.phpfreaks.com/topic/192162-oop-oo-how-do-i-_-keep-the-object-alive/ Share on other sites More sharing options...
salathe Posted February 15, 2010 Share Posted February 15, 2010 Define "destroys" (or "destrozing" for that matter, hehe). Is $a no longer available? Or, what precisely is your problem as you haven't really given much detail to work with. Quote Link to comment https://forums.phpfreaks.com/topic/192162-oop-oo-how-do-i-_-keep-the-object-alive/#findComment-1012697 Share on other sites More sharing options...
sangoku Posted February 15, 2010 Author Share Posted February 15, 2010 I could post the whole project here but it is around 1000 rows...(and coments, names... is on serbian) so i have to try to narrow the problem down. it is like this: I have a class which is a representation of some BD data, i defined a function which needs to update the data by creation of the object. the data should load automatically according to some static data (ip address). grab the data and lets me work with it. the update function i wrote duos the update in the DB but looses the object in the process because the sql query function returns true or false. My question is, when duos a object get destroyed? class class(){ $a; $b; function __construct(){ self::do(); } function do(){ do some DB changes; repopulate the object; } and when i calll the new class i get into the varable 0; Any idea why this happens? Quote Link to comment https://forums.phpfreaks.com/topic/192162-oop-oo-how-do-i-_-keep-the-object-alive/#findComment-1012707 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.