Fatal error: Call to a member function getMessage() on a non-object in

Discussion in 'PHP' started by talker1, Apr 13, 2011.

  1. #1
    Hi

    I have this error

    Fatal error: Call to a member function getMessage() on a non-object in


    
                            if ($_POST[pingbot2] == 'YES')
                                {
                                $dataping = array(
                                    'key' => $site['pinglerapi'],
                                    'url' => $data[0][link],
                                    'title' => urlencode($content[title]),
                                    'category_id' => $category_pingler
                                );
                                pingler($dataping);
                                flush();
                                ob_flush();
                                }
               echo '<div>' . $datasite[$i][url] . ' ... <font color="#FF3333">ล้มเหลว !!</font> | ' . $e->getMessage() . ' |</div>';
                            flush();
                            ob_flush();
               echo '<div>' . $datasite[$i][url] . ' ... <font color="#FF3333">ล้มเหลว !!</font> | ' . $e->getMessage() . ' |</div>';
                            flush();
                            ob_flush();
                            }
                        break;
                        }
    
    PHP:
    this line: echo '<div>' . $datasite[$i] . ' ... <font color="#FF3333">ลà...e() . ' |</div>'; How can fix it? Thank you
     
    talker1, Apr 13, 2011 IP
  2. SametAras

    SametAras Well-Known Member

    Messages:
    53
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    113
    #2
    Can you share getMessage() function?
     
    SametAras, Apr 13, 2011 IP
  3. talker1

    talker1 Active Member

    Messages:
    160
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #3
    talker1, Apr 13, 2011 IP
  4. mastermunj

    mastermunj Well-Known Member

    Messages:
    687
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    110
    #4
    It seems $e is exception object but I see no try - catch block in code / file you provided.
    Either its written wrong or there is a wrapper within the file where this file is included.

    Please have a look around and let us know if you find any try catch block. If not, you may opt to remove $e->getMessage() from code above.
     
    mastermunj, Apr 13, 2011 IP