I have this SQL query that gathers set information for the Salesperson($user) that is logged in and viewing theri need information.
Everything works weell, except my Loop Count.
I don’t know, what I am doping incorrectly. It returns only two values which are the same.
But the Query returns 10 values for that user. When I run the query direct in SQL DB.
What am I missing?
<div class='page_content clearfix'>
<div class='grid_8 first'>
<?php
$salesPersonId = & JFactory::getUser()->get('username');
//$merchantId = JFactory::getSession()->get('merchantId');
$db =& JFactory::getDBO();
$query = " SELECT XXX_merchant.*, XXX_merchant.name as MercName, XXX_merchant.address as MercAddress
FROM XXX_sales_person, jXXX_merchant
WHERE XXX_sales_person.user_name = '$salesPersonId'
AND XXX_merchant.sales_person_id = XXX_sales_person.id";
$db->setQuery( $query );
$row = $db->loadObject();
//echo $query;
//echo $query;
//echo '<br>';
//echo $salesPerson->name;
?>
<?php
$link = 'index.php?option=XXX&controller=deal&task=view&id=' . $row->id;
$count = 0;
foreach ( $row as $row):
$link = '/index.php?option=XXX&controller=merchant&task=edit&cid[]=' . $row->id;
?>
<div class='quickie_login grid_9 last' style="width: 140px">
<div class='text_center' id='login_banner'>
<div class='page_content text_center'>
<div class="avatar" style="float: left; margin-top: -10px; padding: 0px;">
<a class="k2Avatar ubAvatar" href="<?php echo $link; ?>" title="<?php echo JText::_($row->MercName); ?> Edit Account" target="_blank">
<span class="ubName" style="display: block; margin-top: -20px;"><b><?php echo $row->MercName; ?></b> </span>
<?php
if(!empty($row->logo_url))
{
$imagePathArr = unserialize(urldecode($row->logo_url));
$link='http://';
$link.= $_SERVER["SERVER_NAME"].$link_server.DS;
$link.=$imagePathArr[0];
$link =str_replace("\\\\","/",$link);
?>
<img src='<?php echo $link; ?>' alt="<?php echo $row->name; ?>" style="max-width: 100px; height:100px;"/>
<?php
}
?>
</a>
</div>
<div class="sales-system2">
<div style="display: block; margin-top: 0px;">
</div>
</div>
</div>
</div>
<?php endforeach;?>