PHP Notice: Undefined property: stdClass:

I've got an array coming back from a Flash app created in Flash Builder 4.

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.

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

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?

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

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?

Really appreciate any input anyone can give.

Updated for full PHP code.

Errors Generated.

[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

[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

[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

[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

<?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->connection = mysqli_connect("ahoey-1:3306", "<Username Removed For StackOverflow>", "<Password Removed for StackOverflow>", "enabmodules") or die(mysqli_connect_error()); } public function getAllItems($search) { $this->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->connection, $sql) or die('Query failed: ' . mysqli_error($this->connection)); $rows = array(); while ($row = mysqli_fetch_object($result)) { $rows[] = $row; } mysqli_free_result($result); mysqli_close($this->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->connect(); $sql = "UPDATE tbltrust SET inst_code = '$item->inst_code', trust_name = '$item->trust_name', trust_code = '$item->trust_code' WHERE trust_key = '$item->trust_key'"; mysqli_query($this->connection, $sql) or die('Query failed: ' . mysqli_error($this->connection)); mysqli_close($this->connection); } /* public function updateItem($item) { $stmt = mysqli_prepare($this->connection, "UPDATE $this->tablename SET trust_code=?, trust_name=?, inst_code=? WHERE trust_key=?"); $this->throwExceptionOnError(); mysqli_stmt_bind_param($stmt, 'sssi', $item->trust_code, $item->trust_name, $item->inst_code, $item->trust_key); $this->throwExceptionOnError(); mysqli_stmt_execute($stmt); $this->throwExceptionOnError(); mysqli_stmt_free_result($stmt); mysqli_close($this->connection); } */ public function getItem($itemID) { // TODO Auto-generated method stub // Return a single record from the database and return the item // Sample code /* $this->connect(); $itemID = mysqli_real_escape_string($this->connection, $itemID); $sql = "SELECT * FROM books where itemID=$itemID"; $result = mysqli_query($this->connection, $sql) or die('Query failed: ' . mysqli_error($this->connection)); $rows = array(); while ($row = mysqli_fetch_object($result)) { $rows[] = $row; } mysqli_free_result($result); mysqli_close($this->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->connect(); $sql = "INSERT INTO books (title, au_first_name, au_last_name) VALUES ('$item->title','$item->au_first_name','$item->au_last_name')"; mysqli_query($this->connection, $sql) or die('Query failed: ' . mysqli_error($this->connection)); $autoid= mysqli_insert_id($this->connection); mysqli_close($this->connection); return $autoid; */ } /* public function updateItem($item) { $stmt = mysqli_prepare($this->connection, "UPDATE tbltrust SET trust_code=?, trust_name=?, inst_code=? WHERE trust_key=?"); $this->throwExceptionOnError(); mysqli_stmt_bind_param($stmt, 'sssi', $item->trust_code, $item->trust_name, $item->inst_code, $item->trust_key); $this->throwExceptionOnError(); mysqli_stmt_execute($stmt); $this->throwExceptionOnError(); mysqli_stmt_free_result($stmt); mysqli_close($this->connection); } */ public function deleteItem($itemID) { // TODO Auto-generated method stub // Delete a record in the database // Sample code /* $this->connect(); $itemID = mysqli_real_escape_string($this->connection, $itemID); $sql = "DELETE FROM books WHERE itemID = $itemID"; mysqli_query($this->connection, $sql) or die('Query failed: ' . mysqli_error($this->connection)); mysqli_close($this->connection); */ } public function count() { // TODO Auto-generated method stub // Return the number of items in your array of records // Sample code /* $this->connect(); $sql = "SELECT * FROM books"; $result = mysqli_query($this->connection, $sql) or die('Query failed: ' . mysqli_error($this->connection)); $rec_count = mysqli_num_rows($result); mysqli_free_result($result); mysqli_close($this->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->connect(); $startIndex = mysqli_real_escape_string($this->connection, $startIndex); $numItems = mysqli_real_escape_string($this->connection, $numItems); $sql = "SELECT * FROM books LIMIT $startIndex, $numItems"; $result = mysqli_query($this->connection, $sql) or die('Query failed: ' . mysqli_error($this->connection)); $rows = array(); while ($row = mysqli_fetch_object($result)) { $rows[] = $row; } mysqli_free_result($result); mysqli_close($this->connection); return $rows; */ } } ?>

--------------Solutions-------------

Oh my :)

$this is the "name" of the current object you are in. I believe that you have just copied that function from inside a larger object, pasted it in a random place, and it now stopped working, because it is missing essential parts of itself...

To use that script, you need the full source code. You should better try to learn some PHP basics, otherwise you will have a hard time figuring them out by yourself.

Category:php Time:2010-06-18 Views:2
Tags: php

Related post

  • Notice: Undefined property: stdClass::$username when using PDO to login 2012-03-12

    I am creating a fairly basic login form using PDO for the first time. I'm pretty new to PDO and can't figure this one out. My code is: require_once('setEnv.php'); require_once( 'functions/functions.php' ); $username = $_REQUEST['username']; $password

  • Wordpress Undefined property: stdClass::$post_type 2009-12-11

    I'm getting this error on my blog did some one had the same error? how can i fix the error? I didnt edited any File. Notice: Undefined property: stdClass::$post_type in /home/a4673438/public_html/wp-includes/link-template.php on line 105 Notice: Unde

  • "Undefined property: stdClass" 2011-12-13

    This error suddenly occurred when Pressflow was added to our Drupal installation. It is coming from a custom module that, prior to Pressflow seemed to work fine. After the addition of Pressflow, running Drush causes this error to display on screen. T

  • Notice: Undefined property - how do I avoid that message in PHP? 2012-04-13

    Hello I am making this call: $parts = $structure->parts; Now $structure only has parts under special circumstances, so the call returns me null. Thats fine with me, I have a if($parts) {...} later in my code. Unfortunately after the code finished

  • Codeigniter Message: Undefined property: stdClass 2012-03-20

    I'm trying to query the db with the following query in the model: function showSpecific(){ $all = $this->session->all_userdata(); $name = $all['u_name']; $id = $this->db ->select('u_id') ->from('users') ->where('u_name', $name) -

  • Notice: Undefined property: nusoapclient::$operation in /PATH/nusoap.php on line 6837 2011-02-24

    I got the following error in my nusoap file, Notice: Undefined property: nusoapclient::$operation in /PATH/nusoap.php on line 6837 Any one got this error and have solution? --------------Solutions------------- I got this error when I was using the "s

  • PHP: Undefined property stdClass, but the property is already exists 2011-03-04

    Below is my class. class MaterialType { public $id; public $name; function getAllMaterialType() { $query = "SELECT * FROM material_types"; $result = mysql_query($query); $arr = array(); while ($row = mysql_fetch_array($result)) { $arr[] = new Materia

  • When I call funcion cidades Notice: Undefined property: Dados::$cidades 2011-12-29

    file capitais.php <?php /*Capitais*/ ini_set('display_errors',1); ini_set('display_startup_erros',1); error_reporting(E_ALL); require_once('dados.php'); $dados = new Dados; $estado = $dados->_estado; $capitais = $dados->_capitais; for($i=1;$

  • Error Using PHP Class Notice: Undefined property 2011-03-30

    I am still a newby with PHP. I have a flash file that passes some variables to a php script and creates a zip file of a group of jpg files. When I had all of the code in one php file everything worked fine. Now I wanted to separate out the script int

  • PHP Newbie question; "notice: undefined property" 2011-04-05

    I'm running the following code: class Foo { private $var = 0; function isVarSet () { return ($this->var != 0); } } ... foo = new Foo(); results in an "undefined property" notice: foo::$var on my PHP (ver. 5.3.5). if I rewrite just the function isV

  • PHP & PDO PHP Notice: Undefined property: Database::$photo? 2010-07-16

    Okay so here is the code that I am using function AddProducts($aTitle, $aDescription, $aPrice, $aQty, $aPhoto) { try { $stmt = $this->pdo->prepare("INSERT INTO products(title, price, description, qty, photo) VALUES(:title, :price, :description,

  • Undefined property | Error when using two classes 2012-04-14

    I'm having the following two classes: Class I: <?php /** * Wrapper class for the Envato marketplaces API */ class envato_api_wrapper { protected $api_key; protected $cache_dir = 'cache'; public $cache_expires = 2; protected $public_url = 'http://m

  • Undefined property: ModelTask::$useDbConfig 2010-02-11

    in CakePHP book example here I try: cake bake all then I choose 1 for Group but i get an error Notice: Undefined property: ModelTask::$useDbConfig in /opt/lampp/htdocs/acl_cake/cake/console/libs/tasks/model.php on line 848 Fatal error: ConnectionMana

  • Codeigniter Undefined property: xxxx_model::$db only from Model 2011-06-20

    First the Model class: class Xxxx_model extends Model { function XxxxModel() { parent::Model(); $this->load->database(); } function isInDatabase() { // Please ignore the sql query, it's just to show some random sql code with results 11. $result

  • PyroCMS error - Undefined Property 2011-07-01

    I have created a site with Pyro on my local server which is running fine. I've put it onto a staging server and it's throwing an error in model.php in the Codeigniter system. Severity: Notice Message: Undefined property: Pages::$session Filename: cor

  • Smarty allow_php_tag reports 'Undefined property: Smarty::$allow_php_tag' 2011-08-19

    So I have an old website which uses an older version of smarty, as today I wanted to upgrade to latest version, and it hit's me with an error: [Fri Aug 19 11:21:19 2011] [error] [client ***.***.***.***] PHP Notice: Undefined property: Smarty::$allow_

  • error in my mvc Undefined property: welcome::$users 2011-12-17

    This question already has an answer here: Call to a member function on a non-object [duplicate] 8 answers At this time I start to build a MVC framework (PHP). Everything is going fine but now I got a problem : Notice: Undefined property: welcome::$us

  • Symfony2: File Upload throws undefined property exception 2012-03-31

    I want to perform an image upload with Symfony2. I followed the cookbook entry but failed so I firstly used the fallback "upload directly in the controller" but here's the same issue. I am getting Notice: Undefined property: Symfony\Component\Form\Fo

  • Notice (8): Undefined property: 2011-07-05

    Please help me with this: am I missing something? I am getting following error: Notice (8): Undefined property: Property::$Project [APP\controllers\properties_controller.php, line 614] // This is code where warning occurs $projects = $this->Proper

Copyright (C) pcaskme.com, All Rights Reserved.

processed in 0.428 (s). 13 q(s)