• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
foreach with different value results is correct but i got error message

#1
Help me please.

Results from print_r($response->results)
Code:
[13] => stdClass Object ( [id] => 738573 [title] => Operation Finale )
[14] => stdClass Object ( [id] => 442249 [title] => The First Purge )
[15] => stdClass Object ( [id] => 79696 [name] => Manifest )

my view
Code:
<? foreach ($response->results as $v){
    $retVal = ($v->title) ? $v->title : $v->name ;
    echo $retval;
<? } ?>

If i use code above, results is correct but i get error message: Undefined property: stdClass::$title.
i know that is uncorrect because foreach for array [15] is false (not results).

how i can fix it.
Reply


Messages In This Thread
foreach with different value results is correct but i got error message - by DELE - 10-03-2018, 11:08 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.