I have the follwing custom code running in the On Load event for a form:
I want the last column in the table to pull from the query defined by:
I know I am blowing the syntax somewhere, but I can't figure it out. 😶
<table style="width:98%; margin-bottom:30px;">
<tr valign="bottom" style="border-bottom:2px solid #444444;">
<td style="width:20%;" align="left">Company Name</td>
<td style="width:15%;" align="left">Registrant Name</td>
<td style="width:10%;" align="left">Purchases<br />To Date</td>
<td style="width:10%;" align="left">% Goal</td>
<td style="width:10%;" align="left">Points<br />To Date</td>
<td style="width:10%;" align="left">% Goal</td>
<td>Logins</td>
<tr>
<?php
foreach($form->data['VIPList'] as $detail):
?>
<td><?php echo $detail['acct_name']; ?></td>
<td><?php echo $detail['acct_reg_fname']; ?> <?php echo $detail['acct_reg_lname']; ?></td>
<td><?php
$showpurchase = number_format($detail['acct_purchase_todate'],2);
echo $showpurchase; ?></td>
<td><?php
if ($detail['acct_purchase_quota'] != 0): $purchaseratio = ($detail['acct_purchase_todate']/$detail['acct_purchase_quota'])*100; else: $purchaseratio = 0;
endif;
$showpurchaseratio = number_format($purchaseratio,0);
echo $showpurchaseratio." %";
?></td>
<td><?php
$showpoints = number_format($detail['acct_points_todate'],0);
echo $showpoints; ?></td>
<td><?php
if ($detail['acct_points_quota'] != 0): $pointsratio = ($detail['acct_points_todate']/$detail['acct_points_quota'])*100; else: $pointsratio = 0;
endif;
$showpointsratio = number_format($pointsratio,0);
echo $showpointsratio." %";
?></td>
<td>
<?php $db =& JFactory::getDBO();
$query="SELECT COUNT(created_by), FROM #__activities_activities WHERE type = 'com' AND package = 'users' AND action = 'login' AND status = 'logged in' and created_by = acct_user_id";
$db->setQuery($query);
$count = $db->loadResult();
echo $count;
?>
</td>
</tr>
<?php
endforeach;
?>
</table>
I want the last column in the table to pull from the query defined by:
<?php $db =& JFactory::getDBO();
$query="SELECT COUNT(*), FROM #__activities_activities WHERE type = 'com' AND package = 'users' AND action = 'login' AND status = 'logged in' and created_by = acct_user_id";
$db->setQuery($query);
$count = $db->loadResult();
echo $count;
?>
I know I am blowing the syntax somewhere, but I can't figure it out. 😶