PHP Classes

File: example

Recommend this page to a friend!
  Classes of Daniel Vasic   Simple DBase   example   Download  
File: example
Role: Example script
Content type: text/plain
Description: example file
Class: Simple DBase
Simple MySQL database access wrapper
Author: By
Last change:
Date: 12 years ago
Size: 559 bytes


Class file image Download
('HOST', 'localhost');
define('USER', 'root');
define('PASS', '');
define('TABLE', 'cms');

$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 />");

/*Fetch data*/
$db->sqlQuery("SELECT id, email FROM comments");
$row = $db->fetchData()){
printf("id : %s\temail : %s<br />",$row['id'], $row['email']);