Patrick Lanfranco
Patrick Lanfranco

Reputation: 309

Error - Trying to get property of non-object

I am currently getting this error on one of my files:

  /var/www/vhosts/httpdocs/generator/index.php on line 6

Line 6 would be resulting in:

  echo $results->GetBookCodesResult->BookCodes->BookInfo->ServiceCode;

My code:

  <?php
  $config['soap_url'] = "http://myservice.com?WSDL";
  if(isset($_REQUEST['codes'])) {
    $results = request_Data(explode("\n",$_REQUEST['codes']));
    echo $results->GetBookCodesResult->BookCodes->BookInfo->ServiceCode;
  }
  ....

What is the best method to have this fixed? Some advice would be appreciated.

Upvotes: 1

Views: 561

Answers (1)

TheHe
TheHe

Reputation: 2972

your "->BookCodes" sub-property is empty as you can see in your var_dump-output...

this property "BookInfo" just not exist.. maybe no books are found? ;)

Upvotes: 2

Related Questions