Welcome Guest, Not a member yet? Register   Sign In
How do i convert this?
#1

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. 

Code:
$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"]);
    }
Reply
#2

Try "parcel_id"=> $row->infouuid (ie reference it as an object, not an array.

I'm just guessing here.
Reply
#3

this returns an object
PHP Code:
$result->result() 

this returns an array
PHP Code:
$result->result_array() 

http://www.codeigniter.com/user_guide/da...sults.html
Reply




Theme © iAndrew 2016 - Forum software by © MyBB