PHP Classes

File: examples_database.php

Recommend this page to a friend!
  Classes of Sven Wagener   database class   examples_database.php   Download  
File: examples_database.php
Role: Example script
Content type: text/plain
Description: Example file for database class
Class: database class
mSQL,MS SQL,MySQL,ODBC,Postgre,Sybase DB Layer
Author: By
Last change: Added example ODBC connect
Date: 20 years ago
Size: 586 bytes
 

Contents

Class file image Download
<?php

include("database.class.php");

// Connecting to database
$db=new database("mysql","localhost","addresses","username","password");

// Switching to debug mode
$db->debug_mode();

// Making query
$db->query("SELECT * FROM addresses");

// Counting results and showing it
echo $db->count_rows();

// Printing results
while($my_row=$db->get_row()){
    echo
$my_row['name'];
}

/*********************
*
* Connecting ODBC database
*
*********************/

// Connecting to odbc database
$db=new database("odbc","","","","",false,"odbc-name-of-db");

?>