Code:
I have this in the view
{foreach from=$menus.Licensees item=this_licen name=licensees}
{if $this_licen.FranchiseeID <> $this_licen.PreviousFranchiseeID}
{if $smarty.foreach.licensees.first}
{else}
</select>
{/if}
{if $vars.Franchisee == $this_licen.FranchiseeID}
{literal}
<script type="text/javascript">
current_open = {/literal}{$this_licen.FranchiseeID}{literal};
</script>
{/literal}
{/if}
<select class="LicenseeSelect" onchange="insert_licensee(this.value);" id="vars[Licensee][{$this_licen.FranchiseeID}]" name="vars[SelectLicensee]" style="{if $vars.Franchisee == $this_licen.FranchiseeID}display: block;{/if}">
<option onclick="insert_licensee(this.value);" value="">All Licensees</option>
<option onclick="insert_licensee(this.value);" {if $vars.Licensee==$this_licen.FranchiseeID} selected="selected"{/if} value="{$this_licen.FranchiseeID}">No Licensee</option>
{/if}
<option onclick="insert_licensee(this.value);" value="{$this_licen.ID}"{if $vars.Licensee==$this_licen.ID} selected="selected"{/if}>{$this_licen.Name}</option>
{/foreach}
I am getting <p>Message: Cannot use object of type stdClass as array</p>
I have this in my controller
$query = "
Code:
WHERE Type = 'Licensee'
Code:
AND Status = 'Active'
Code:
ORDER BY FranchiseeID";
Code:
$menus["Licensees"]=array();
Code:
$total_licensees_elements = 0;
Code:
if($result=$this->db->query($query)){
Code:
if($result->num_rows() > 0) {
Code:
while ($row = $result->unbuffered_row()){
Code:
if($row->FranchiseeID <> $prev_id){
Code:
$total_licensees_elements++;
Code:
$row->PreviousFranchiseeID = $prev_id;
Code:
$menus["Licensees"][]=$row;
Code:
$prev_id = $row->FranchiseeID;
Code:
}
How do I get $menus["Licensees"] in the right format please
Thanks