Location: PHPKode > scripts > PhpDtObject > phpdtobject/index.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>PhpDtObject Index</title>
<style type="text/css">
body,td,th {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 14px;
	color: #333333;
body {
	background-color: #EDF0F3;
a:link {
	color: #0000CC;
	text-decoration: none;
a:visited {
	text-decoration: none;
	color: #0000CC;
a:hover {
	text-decoration: underline;
	color: #FF9933;
a:active {
	text-decoration: none;
	color: #0000CC;
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 12px;
	color: #996611;

<table width="650" border="0" cellpadding="0" cellspacing="1" bgcolor="#999999">
<table width="650" border="0" cellpadding="10" cellspacing="0" bgcolor="#F8F8F8">
    <td><h3>OWAB - Online Web Application Builder Class Set </h3>
      <p><strong>PHPDTOBJECT v. 0.01</strong></p>
      <p>Database table access classes for php. </p>
      <p>These classes simplifies the procedure, when trying to get information, edit, insert or delete rows from the database table. PhpDtObject makes an object from the table row or an object array if multiple rows are returned from the table. Objects can also be created with init method, that passes primary key (usually id) and its value or by getOne / getMany methods where you can specify more complex searching criteria. Rows can be updated, deleted and new rows created with a simple method calls. </p>
      <p>By extending this class you have basic access to the database tables and you can concentrate to your own class functionality.</p>
      <p>Classes are quite similar to Dao, but may be used for little different purposes. PhpDtObject uses ADOdb (database abstraction layer), so it requires ADOdb to be installed on server. ADOdb is a free set of php classes, that you can download from: <a href="http://php.weblogs.com/adodb">http://php.weblogs.com/adodb</a></p>
      <p><strong>INCLUDED FILES</strong></p>
      <p><a href="ReadMe.txt">ReadMe.txt</a> ReadMe file.</p>
      <p><a href="index.html">index.html</a> Actually you are reading it now!</p>
      <p><a href="License.txt">License.txt</a> GNU LESSER GENERAL PUBLIC LICENSE.</p>
      <p><a href="#">DBConn.php</a> Database connection class.</p>
      <p><a href="#">PhpDtObject.php</a> Main class. Include this to your applications.</p>
      <p><a href="#">PhpDtObject_DB.php</a> This class is included automatic with PhpDtObject</p>
      <p><a href="#">test.php</a> Test and example file.<br>
          In addition to these files PhpDtObject needs ADOdb package to support different databases. You can download ADOdb from: <a href="http://php.weblogs.com/adodb">http://php.weblogs.com/adodb</a></p>
      <p>Whole package with all necessary files can be downloaded from:  <a href="http://www.hmv-systems.fi/marko/PhpDtObject/PhpDtObject_with_ADOdb.zip">http://www.hmv-systems.fi/marko/PhpDtObject/PhpDtObject_with_ADOdb.zip</a> or <br>
        <a href="http://mcenter.artesaani.net/OWAB/">http://mcenter.artesaani.net/OWAB/</a> -&gt; PhpDtObject</p>
      <hr>      <p><strong>EXAMPLE</strong></p>
      <p>1. Use your favourite database access tool to create following table with insert clauses:</p>
      <p>DROP TABLE IF EXISTS `test`;<br>
CREATE TABLE `test` (<br>
`id` int(11) NOT NULL auto_increment,<br>
`name` varchar(32) NOT NULL default '',<br>
`age` int(3) NOT NULL default '0',<br>
`date` date NOT NULL default '0000-00-00',<br>
PRIMARY KEY (`id`)<br>
<p>INSERT INTO `test` VALUES (1, 'Tester', 32, '2004-06-09');<br>
INSERT INTO `test` VALUES (2, 'Quaker', 99, '2004-06-09');<br>
INSERT INTO `test` VALUES (3, 'Bobby', 5, '2004-06-09');</p></pre>
      <p>2. Setup database connection class. You can do it straight to the class field variables (or by setting public field variables from the script. See test file for that.):</p>
      <pre><p> var $driver = &quot;mysql&quot;;<br>
var $server = &quot;localhost&quot;;<br>
var $port = &quot;&quot;;<br>
var $socket = &quot;&quot;;<br>
var $username = &quot;root&quot;;<br>
var $password = &quot;******&quot;;<br>
var $db = &quot;test&quot;; </p></pre>
      <p>3. Include all necessary classes to your script:</p>
      <pre><p>include_once( &quot;./adodb/adodb.inc.php&quot; );<br>
include_once( 'DBConn.php' );<br>
include_once( 'PhpDtObject.php' );</p></pre>
      <p>4. Make database connection to the specific table (test):</p>
      <pre><p>$dbconn = new DBConn( &quot;test&quot; );<br>
if( !$dbconn-&gt;connect() )<br>
    exit( &quot;Connection to database could not be done! Please check, that DBConn class is properly setted.&quot; ); </p></pre>
      <p>5. Get &amp; print row with id = 1</p>
      <pre><p>$obj1 = new PhpDtObject( $dbconn );<br>
$obj1-&gt;init( 1 );<br>
print &quot;&lt;pre&gt;EXAMPLE 1.&lt;br /&gt;&quot;;<br>
print_r( $obj1-&gt;getIndex() );<br>
print &quot;&lt;/pre&gt;&quot;; </p></pre>
      <p>See more examples from the test.php file. </p>
      <p>Marko Manninen<br>
  6.5.2004, Kajaani</p>
<p>mob: +358 44 2927529<br>
  email: <a href="mailto:hide@address.com">hide@address.com<br>
  </a>web1: <a href="http://mcenter.artesaani.net/OWAB/">http://www.hmv-systems.fi/marko/PhpDtObject/</a><br>
    web2: <a href="http://mcenter.artesaani.net/OWAB/">http://mcenter.artesaani.net/OWAB/</a></p>
    <td><div align="center"></div></td>
Return current item: PhpDtObject