PHP Classes

File: example.php

Recommend this page to a friend!
  Packages of V. Yanson   rsmysql   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example
Class: rsmysql
Measure time spent executing MySQL queries
Author: By
Last change:
Date: 20 years ago
Size: 514 bytes
 

 

Contents

Class file image Download
<?php

include_once('class.mysql.php');

// database configuration
$GLOBALS['db_conf'] = array(
    'host'    =>    'localhost',
    'user'    =>    'root',
    'pass'    =>    'whatever',
    'db'    =>    'my_database',
    'pers'    =>    false // persistent connection?
);

$db = new mysql($conf);

// execute query
$ret = $db->query('select * from my_table where active=1');
print_r($ret);
echo 'Total queries: ' . $GLOBALS['total_mysql_queries'] . "\n";
echo 'Total query execution time: ' . $GLOBALS['total_mysql_time'] . "\n";

?>