Jump to content

OOP O.o how do i >_< keep the object alive?


sangoku

Recommended Posts

hy again :wtf:,

:'(

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?

Link to comment
https://forums.phpfreaks.com/topic/192162-oop-oo-how-do-i-_-keep-the-object-alive/
Share on other sites

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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.