<?php 
 
define('HOST', 'localhost');
 
define('USER', 'root');
 
define('PASS', '');
 
define('TABLE', 'cms');
 
 
include("db_class.inc.php");
 
$db = new db (HOST, USER, PASS, TABLE);
 
/*Count rows*/
 
    $db->sqlQuery("SELECT null FROM comments");
 
    $string = printf("You have ". $db->numRows() . " fields in this table<br />");
 
    $db->clearQuery();
 
 
/*Fetch data*/
 
    $db->sqlQuery("SELECT id, email FROM comments");
 
    while($row = $db->fetchData()){
 
        printf("id : %s\temail : %s<br />",$row['id'], $row['email']);
 
    }
 
    $db->clearQuery();
 
$db->close();
 
 
?>
 
 |