Welcome Guest, Not a member yet? Register   Sign In
<p>Message: Cannot use object of type stdClass as array</p>
#1

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:
                    SELECT        *
Code:
                    FROM        Users
Code:
                    WHERE        Type = 'Licensee'
Code:
                    AND            Status = 'Active'
Code:
                    ORDER BY    FranchiseeID";
Code:
            $menus["Licensees"]=array();
Code:
            $prev_id = 0;
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:
                        }
Code:
                        $row->PreviousFranchiseeID = $prev_id;
Code:
                        $menus["Licensees"][]=$row;
Code:
                        $prev_id = $row->FranchiseeID;
Code:
                    }
Code:
                }
Code:
            }


How do I get $menus["Licensees"] in the right format please


Thanks
Reply


Messages In This Thread
<p>Message: Cannot use object of type stdClass as array</p> - by Knutsford - 11-23-2020, 12:29 PM



Theme © iAndrew 2016 - Forum software by © MyBB