Scenario:
A script with two objects. One for connecting to the database and one for counting generation time. The generation time object will also count the time spent dealing with the mysql database right, as well as the time spent on generating hte script. so how could i get the database connection object use the object that is counting time? how can i get the objects to talk to each other? here's is my script, if you want the class source codes i can post those too... I just started writing OO code a couple of days ago, so any help would be appreciated. Thanks!
<?
// Class.php
require("./ExecutionTimer.cls");
require("./DatabaseConnect.cls");
$q = new ExecutionTimer();
require("./ErrorHandling.cls");
$r = new ErrorHandling();
$m = new DatabaseConnect("localhost", "root", "", "management");
$qry = $q->query("SELECT * FROM users") or die($r->returnErrorText(101, 0, __LINE__, __FILE__));
echo "<br>time spend dealing with mysql database: ".$q->myExecTime();
$q->stopTimer(); // stopping script timer.
echo "<br>total mysql queries: ". $q->myQueries();
echo "<br>average time per query: ". $q->myQryAve();
echo "<br>total script execution time: ". $q->execTime();
echo "<br>time spend on script, not including mysql functions:". $q->execPHP();
?>
example output:
time spend dealing with mysql database: 0.0007399321
total mysql queries: 1
average time per query: 0.0007399321
total script execution time: 0.0054320097
time spend on script, not including mysql functions:0.0046920776