Thread: Use a Function
View Single Post
Old 02-03-2013, 07:36 PM   PM User | #1
ROYW1000
Regular Coder

 
Join Date: Jan 2010
Posts: 151
Thanks: 10
Thanked 1 Time in 1 Post
ROYW1000 is an unknown quantity at this point
Use a Function

Hi

I have got a query counter to run using the following code:

PHP Code:
class dbAccess {

        var 
$resID;
        var 
$lastError;
        var 
$currentDatabase;
        var 
$queriesRun;
        var 
$lastQuery;
        var 
$timeTotal;
        [
B]var $roysqueries;[/B
PHP Code:
function dbAccess() {
            
$this->resID FALSE;
            
$this->lastError "";
            
$this->queriesRun 0;
            
$this->lastQuery "";
            
$this->timeTotal 0;
            [
B]$this->roysqueries 0;[/B]
        } 
PHP Code:
function showroysqueries() {
            echo 
"Roys Total Queries: ".$this->roysqueries;
        } 
If I echo the .$this->roysqueries it works ok but now I need to use that variable in another page.

Is there a way I can say for example $test1 = $this->roysqueries

Thanks
Roy
ROYW1000 is offline   Reply With Quote