2010-01-21 7 views

답변

0
적절한 JTable의를 가진

가장 좋은 방법 :

$row =& JTable::getInstance('my_table', ''); 
$row->load($id); 

하는 JTable가없이 작업 :

$db = &JFactory::getDbo(); 
$sql = 'SELECT * FROM #__table WHERE id ='.$id; 
$db->setQuery($sql); 
$object = $db->loadObject(); 

OFC 당신이 MVC 내부 즉 더 우아 할 수 있습니다. 하지만 처음에는 충분합니다.

0
$db = JFactory::getDBO(); 

$query = "select id,title from #__content"; 

$db->setQuery($query); 

$result = $db->loadObjectList();//here we got array of stdClass===prepared objects in PHP 5.3 

foreach($result as $res){ 
    echo $res->id."".$res->title; 
} 
관련 문제