PHP Classes
elePHPant
Icontem

File: aguencyentries.cls.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Duy A. Nguyen  >  Small MySQL Connection  >  aguencyentries.cls.php  >  Download  
File: aguencyentries.cls.php
Role: Application script
Content type: text/plain
Description: sample class
Class: Small MySQL Connection
MySQL database access wrapper
Author: By
Last change:
Date: 9 years ago
Size: 1,192 bytes
 

Contents

Class file image Download
<?php
class AguEncyEntries extends MagicObject implements IRenderHTML
{
    private
$table_name;
   
      function
__construct()
    {
          global
$g_config;
       
       
$this->table_name = $g_config['table_prefix'] . 'entries';
       }
   
    public function
loadByName($cond_name)
    {
         
$sql = "select id, name, description, screenshoot, iscat, parentid from $this->table_name where name like ?";
         
         
$db = MySQLConnection::init();
       
       
$ret = $db->executeQuery($sql, $cond_name . '%');
       
        if(
$ret )
        {
           
$count = count($ret);
           
            for(
$i = 0 ; $i < $count; $i++ )
            {
               
$this->data[$i] = new AguEncyEntry();
               
$o = &$this->data[$i];
               
               
$o->id = $ret[$i]['id'];
               
$o->name = $ret[$i]['name'];
               
$o->description = $ret[$i]['description'];
               
$o->screenshoot = $ret[$i]['screenshoot'];
               
$o->iscat = $ret[$i]['iscat'];
               
$o->parentid = $ret[$i]['parentid'];
               
            }
           
            return
$count;
        }
       
        return
false;
    }
   
    public function
outputHTML()
    {
// $count = count($this->data);
// foreach($this->data as $key => $row)
// $row->outputHTML();
       
echo('<pre>');

       
var_dump($this->data);
        echo(
'</pre>');
    }
}

?>