[PHP]Fatal Error

Discussion in 'Scripts, 3rd Party Apps, and Programming' started by Shadow121, Feb 16, 2008.

  1. Shadow121

    Shadow121 Member

    Messages:
    901
    Likes Received:
    0
    Trophy Points:
    16
    WooHoo for once i'm not sure what to do! well.. once again kind of..

    Right, heres my code.
    Code:
    <?php
    }else{
        $notes = addslashes($_POST['notes']);
        $update = $MySql->sqlQuery("UPDATE `".DB_PREFIX."notes` SET `content` = '$notes' WHERE `username`= '-------XxStaffxX-------';");
        print "Notes Updated! Please Wait...";
        $Functions->redirect('http://joe.hrwr.org/admin1/', '2');
    }
    ?>
    
    Then my Redirect Code:
    Code:
        function redirect($where, $time = '10'){
            require('Lib/footer.php');
            sleep($time);
            print "<script type=\"text/javascript\">
            window.location.href='$where';
            </script>\r\n";
        }
    
    footer code:
    Code:
                <b>Total Queries</b>: <?=$MySql->QueryCounter?> | 
                <b>Total Exec. Time</b>: <?=$MySql->getTotalTime()?>
                </p>
    
    Then the error:
    Code:
    [B]Fatal error[/B]:  Call to a member function getTotalTime() on a non-object in [B]/home/shadow31/public_html/joe/Lib/footer.php[/B] on line [B]14
    [/B]
    Some Facts:
    1. header.php is included up top before all scripts
    2. footer.php has access to the mySQL Functions

    thats about it got tips? do post. lol
     
  2. Synkc

    Synkc Active Member

    Messages:
    1,765
    Likes Received:
    0
    Trophy Points:
    36
    Have you defined "getTotalTime()" as a public function in your MySQL class?

    Code:
    Fatal error:  Call to a member function getTotalTime() on a non-object in /home/shadow31/public_html/joe/Lib/footer.php on line 14
    Considering the error is about an undeclared object, and that you seem to have indeed created one, I'm not sure what could be wrong lol. Have you tried just re-declaring the object just before you attempt to use the "getTotalTime()" function, just to see whether that is the problem, or instead of using raw html, remove the opening and closing php tags, and use echo() to display the content?

    If none of that works I have no idea what could be wrong with your script.
     
    Last edited: Feb 16, 2008
  3. Shadow121

    Shadow121 Member

    Messages:
    901
    Likes Received:
    0
    Trophy Points:
    16
    Yes i have for it works when i have not submitted the edit notes form ;3
     
  4. taekwondokid42

    taekwondokid42 New Member

    Messages:
    268
    Likes Received:
    0
    Trophy Points:
    0
    Can you give us the whole code?

    It would be easier to find the error in line 14 if we knew where line 14 was in footer.php
     
  5. Shadow121

    Shadow121 Member

    Messages:
    901
    Likes Received:
    0
    Trophy Points:
    16
    I've managed to fix this hehe added require the footer file outside ther function and before declaring it then the redirect functions ;)
     

Share This Page