Jump to content

using class variables in other parts of the script - whoa this is tough...


dbidirect

Recommended Posts

ok. first thanks for taking a look.

 

the problem - this  bit of code $this->total_rows = mysql_num_rows($all_rs );

holds a number that i need to use in another part of the script - i have been working on this for hours. i read something about "contants" but was not able to get to work. also read about turning it global but i have no idea how to do that. btw - it sits in a class.

 

thanks so much.

 

jt

You need to create  a method within your object that will return this data from the object. eg;

 

public function getTotalRows()
{
    return $this->total_rows;
}

 

You can now call this method within your client code to retrieve the value. eg;

 

$total = $obj->getTotalRows();

 

This really is the absolute basics of object usage.

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.