<?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>');
}
}
?>
|