dbidirect Posted March 23, 2010 Share Posted March 23, 2010 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 Link to comment https://forums.phpfreaks.com/topic/196212-using-class-variables-in-other-parts-of-the-script-whoa-this-is-tough/ Share on other sites More sharing options...
trq Posted March 23, 2010 Share Posted March 23, 2010 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. Link to comment https://forums.phpfreaks.com/topic/196212-using-class-variables-in-other-parts-of-the-script-whoa-this-is-tough/#findComment-1030421 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.