如何在Joomla中使用mysql变量!查询生成器并使用loadObjectList()
?
答案 0 :(得分:0)
非常简单
$query = $db->getQuery(true);
$query->select('apses.*,'
. ' @sess_total_uptime := TIMESTAMPDIFF(MINUTE, apses_date_created, apses_last_activity) as sess_total_uptime, '
. ' FLOOR(@sess_total_uptime / 60) as hours, '
. ' ROUND(MOD(@sess_total_uptime, 60)) as mins '
);
$query->from($db->quoteName('#__mysessions', 'apses'));
$db->setQuery($query);
$db->execute(); // <-- This thing is *VERY* IMP
$rows = $db->loadObjectList();