CodeIgniter Forums

Full Version: How do i convert this?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How do i get this working i receive this error 
Quote:Cannot use object of type stdClass as array
with the below snippet the issue seems to be with the foreach. 

$result = $zgrid->query("SELECT * FROM parcels WHERE $category " .
            "(parcelname LIKE '%$text%'" .
            " OR description LIKE '%$text%')" .
            $type . " ORDER BY $order parcelname" .
            " LIMIT ".(0+$query_start).",101");

    $data = array();
    foreach($result->result() as $row ){
        $data[] = array(
                "parcel_id" => $row["infouuid"],
                "name" => $row["parcelname"],
                "for_sale" => "False",
                "auction" => "False",
                "dwell" => $row["dwell"]);
Try "parcel_id"=> $row->infouuid (ie reference it as an object, not an array.

I'm just guessing here.
this returns an object
PHP Code:

this returns an array
PHP Code: