PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Matt Malenski   table_class   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: example of an instance of the table class
Class: table_class
Base class to be extended for any mysql table
Author: By
Last change:
Date: 22 years ago
Size: 985 bytes
 

Contents

Class file image Download
<?php

define
(SQL_SERVER, "");
define(DEFAULT_DB, "");
define(SQL_USER, "");
define(SQL_PASS, "");

mysql_connect(SQL_SERVER,SQL_USER,SQL_PASS);

require(
'./table_class.php');
require(
'./project_class.php');


/******************************/
// AN EMPTY PROJECT
/******************************/
$myPrj = new Project();
$myPrj->pprint();


/******************************/
// THE PROJECT WITH ID=896
/******************************/
$myPrj = new Project(896);
$myPrj->pprint();


/******************************************************************************/
// My Standard mmyqsl helper function
/******************************************************************************/
function mmysql($query,$db='0'){
        if(
$db == '0'){
           
$db = DEFAULT_DB;
        }
       
$result = mysql($db,$query);
        if(
mysql_error()){
           
$result = "QUERY: $query\n";
           
$result .= "ERROR: ".mysql_error()."\n";
            print
$result;
            exit;
            }
        return
$result;
}

?>