|
Page 6 of 9 class.hello_world.php - The database class file. <?php //hello_world Component// /** * Content code * @package hello_world * @Copyright (C) 2004 Doyle Lewis * @ All rights reserved * @ hello_world is Free Software * @ Released under GNU/GPL License : http://www.gnu.org/copyleft/gpl.html * @version 1.0 **/ defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); class mosHello_world extends mosDBTable { // INT(11) AUTO_INCREMENT var $id=null; // TEXT var $text=null; // TINYINT(1) var $published=null; function mosHello_world( &$db ) { $this->mosDBTable( 'mos_hello_world', 'id', $db ); } } Now let's look at how the file works: class mosHello_world extends mosDBTable { This line will always look like this, but change mosHello_world to what you want your class named. // INT(11) AUTO_INCREMENT var $id=null; The commented line just gives info about the variable. The variable line has to match your db column exactly, and always set it equal to null. function mosHello_world( &$db ) { $this->mosDBTable( 'mos_hello_world', 'id', $db ); } This is what creates your output when you use $row = new mosHello_world( $database );
|