PHP Notice: Undefined property: stdClass:
<p>I've got an array coming back from a Flash app created in Flash Builder 4.</p>

<p>I have a service setup that queries and brings data back from the DB successfully, however the Update script is generating the Undefined Property errors.</p>

<p>I'm still learning both PHP and Flash Builder, and don't fully understand what the $this-> commands do.</p>

<p>If anyone can suggest where this script is going wrong, it is basically just generated by Flash Builder and is not something I've developed myself, I would appreciate it?</p>

<p>Also if someone can explain $this-> to me that would be awesome too?</p>

<p>I've seen them before, but then I've seen scripts doing the same thing that do not use them, so is this an old way of doing things?</p>

<p>Really appreciate any input anyone can give.</p>

<p>Updated for full PHP code.</p>

<p>Errors Generated.</p>

<p>[18-Jun-2010 13:01:37] PHP Notice:  Undefined property: stdClass::$inst_code in C:\wamp\www\Coradia-175105-debug\services\tbltrustservice.php on line 48</p>

<p>[18-Jun-2010 13:01:37] PHP Notice:  Undefined property: stdClass::$trust_name in C:\wamp\www\Coradia-175105-debug\services\tbltrustservice.php on line 48</p>

<p>[18-Jun-2010 13:01:38] PHP Notice:  Undefined property: stdClass::$trust_code in C:\wamp\www\Coradia-175105-debug\services\tbltrustservice.php on line 48</p>

<p>[18-Jun-2010 13:01:38] PHP Notice:  Undefined property: stdClass::$trust_key in C:\wamp\www\Coradia-175105-debug\services\tbltrustservice.php on line 48</p>

<pre><code>        &lt;?php

//reroute errors to get rid of that annoying CHANNEL DISCONNECTED message.
ini_set('error_log', 'errorLog.txt');
ini_set('html_errors', '0');
ini_set('display_errors', '0');
ini_set('log_errors', '1');

class tbltrustservice {

    public $connection;

    public function connect() {
            $this-&gt;connection = mysqli_connect("ahoey-1:3306",  "&lt;Username Removed For StackOverflow&gt;",  "&lt;Password Removed for StackOverflow&gt;", "enabmodules") or die(mysqli_connect_error());
    }

    public function getAllItems($search) {
              $this-&gt;connect();

              if ($search=="") {
              $sql = "SELECT * FROM tbltrust";
              } else {
              $sql = 'SELECT * FROM tbltrust WHERE trust_name LIKE \'%'.mysql_escape_string($search).'%\' OR trust_code LIKE \''.mysql_escape_string($search).'%\' OR inst_code LIKE \'%'.mysql_escape_string($search).'%\'';
              }

              $result = mysqli_query($this-&gt;connection, $sql) or die('Query failed: ' . mysqli_error($this-&gt;connection));

              $rows = array();
              while ($row = mysqli_fetch_object($result)) {
                    $rows[] = $row;
              }

              mysqli_free_result($result);
              mysqli_close($this-&gt;connection);

              return $rows; 
    }



    public function updateItem($item) {
        // TODO Auto-generated method stub
        // Update an existing record in the database and return the item

        // Sample code \'

              $this-&gt;connect();
              $sql = "UPDATE tbltrust SET inst_code = '$item-&gt;inst_code', trust_name = '$item-&gt;trust_name', trust_code = '$item-&gt;trust_code' WHERE  trust_key = '$item-&gt;trust_key'";

              mysqli_query($this-&gt;connection, $sql) or die('Query failed: ' . mysqli_error($this-&gt;connection));

              mysqli_close($this-&gt;connection);

    }


/*
    public function updateItem($item) {

        $stmt = mysqli_prepare($this-&gt;connection, "UPDATE $this-&gt;tablename SET trust_code=?, trust_name=?, inst_code=? WHERE trust_key=?");     
        $this-&gt;throwExceptionOnError();

        mysqli_stmt_bind_param($stmt, 'sssi', $item-&gt;trust_code, $item-&gt;trust_name, $item-&gt;inst_code, $item-&gt;trust_key);        
        $this-&gt;throwExceptionOnError();

        mysqli_stmt_execute($stmt);     
        $this-&gt;throwExceptionOnError();

        mysqli_stmt_free_result($stmt);     
        mysqli_close($this-&gt;connection);
    }
*/
    public function getItem($itemID) {
        // TODO Auto-generated method stub
        // Return a single record from the database and return the item

        // Sample code
        /*
              $this-&gt;connect();
              $itemID = mysqli_real_escape_string($this-&gt;connection, $itemID);
              $sql = "SELECT * FROM books where itemID=$itemID";

              $result = mysqli_query($this-&gt;connection, $sql) or die('Query failed: ' . mysqli_error($this-&gt;connection));

              $rows = array();
              while ($row = mysqli_fetch_object($result)) {
                    $rows[] = $row;
              }

              mysqli_free_result($result);
              mysqli_close($this-&gt;connection);

              return $rows;
        */  
    }

    public function createItem($item) {
        // TODO Auto-generated method stub
        // Insert a new record in the database using the parameter and return the item

        // Sample code
        /*
              $this-&gt;connect();
              $sql = "INSERT INTO books (title, au_first_name, au_last_name) 
              VALUES ('$item-&gt;title','$item-&gt;au_first_name','$item-&gt;au_last_name')";  

              mysqli_query($this-&gt;connection, $sql) or die('Query failed: ' . mysqli_error($this-&gt;connection));

              $autoid= mysqli_insert_id($this-&gt;connection);
              mysqli_close($this-&gt;connection);

              return $autoid;
        */  
    }

/*
public function updateItem($item) {

        $stmt = mysqli_prepare($this-&gt;connection, "UPDATE tbltrust SET trust_code=?, trust_name=?, inst_code=? WHERE trust_key=?");     
        $this-&gt;throwExceptionOnError();

        mysqli_stmt_bind_param($stmt, 'sssi', $item-&gt;trust_code, $item-&gt;trust_name, $item-&gt;inst_code, $item-&gt;trust_key);        
        $this-&gt;throwExceptionOnError();

        mysqli_stmt_execute($stmt);     
        $this-&gt;throwExceptionOnError();

        mysqli_stmt_free_result($stmt);     
        mysqli_close($this-&gt;connection);
    } */

    public function deleteItem($itemID) {
        // TODO Auto-generated method stub
        // Delete a record in the database

        // Sample code
        /*
              $this-&gt;connect();
              $itemID = mysqli_real_escape_string($this-&gt;connection, $itemID); 
              $sql = "DELETE FROM books WHERE itemID = $itemID";

              mysqli_query($this-&gt;connection, $sql) or die('Query failed: ' . mysqli_error($this-&gt;connection));

              mysqli_close($this-&gt;connection);
        */  
    }

    public function count() {
        // TODO Auto-generated method stub
        // Return the number of items in your array of records

        // Sample code
        /*
              $this-&gt;connect();
              $sql = "SELECT * FROM books";

              $result = mysqli_query($this-&gt;connection, $sql) or die('Query failed: ' . mysqli_error($this-&gt;connection));
              $rec_count = mysqli_num_rows($result);

              mysqli_free_result($result);
              mysqli_close($this-&gt;connection);

              return $rec_count;
        */  
    }

    public function getItems_paged($startIndex, $numItems) {
        // TODO Auto-generated method stub
        // Return a page of records as an array from the database for this startIndex

        // Sample code
        /*
              $this-&gt;connect();
              $startIndex = mysqli_real_escape_string($this-&gt;connection, $startIndex); 
              $numItems = mysqli_real_escape_string($this-&gt;connection, $numItems); 
              $sql = "SELECT * FROM books LIMIT $startIndex, $numItems";

              $result = mysqli_query($this-&gt;connection, $sql) or die('Query failed: ' . mysqli_error($this-&gt;connection));

              $rows = array();
              while ($row = mysqli_fetch_object($result)) {
                    $rows[] = $row;
              }

              mysqli_free_result($result);
              mysqli_close($this-&gt;connection);

              return $rows;
        */  
    }


    }

?&gt;
</code></pre>
