Login   Register  
PHP Classes
elePHPant
Icontem

File: example.UseNewClass.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of zengwenjie  >  genpo  >  example.UseNewClass.php  >  Download  
File: example.UseNewClass.php
Role: Example script
Content type: text/plain
Description: how to use the generated class
Class: genpo
Generate class to access table records as objects
Author: By
Last change:
Date: 5 years ago
Size: 1,232 bytes
 

Contents

Class file image Download
<?php 
 
include "ado/adodb.inc.php";
include 
"ado/class.ConnDb.php";
include 
"class.compinfo.php"//this is the class witch is generated by us.
//initialize all parameter
$dbserver="localhost";$dbuser="annie";$dbpass="annie";
$link=mysql_connect($dbserver,$dbuser$dbpass);
$dbname="annie";


#The location and credentials for the slave database
#server used by this server
$dbSlaveCredentials['server'] = $dbserver;
$dbSlaveCredentials['user'] = $dbuser;
$dbSlaveCredentials['password'] = $dbpass;
#The location and credentials for the master database
#server (usually on localhost) used by this server
$dbMasterCredentials['server'] = $dbserver;
$dbMasterCredentials['user'] = $dbuser;
$dbMasterCredentials['password'] = $dbpass;
$applicationDb = new ConnDb($dbname); //this global value will be used by generated class.

//use the class to oprater table compinfo.
$cinfoin= new compinfo();
$cinfoin->set_compname("a comp name");
$cinfoin->set_mylink("a comp link");
$cinfoin->set_intime("2008-09-17");
$cinfoin->db_save();
$id=$cinfoin->get_id();
echo 
"id=".$id;
$cinfoout = new compinfo($id);
echo 
"<br>";
echo 
$cinfoout->get_compname()."<br>";
echo 
$cinfoout->get_mylink()."<br>";

  
?>