Web Analytics Made Easy -
StatCounter need help with some errors - CodingForum

Announcement

Collapse
No announcement yet.

need help with some errors

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • need help with some errors

    Fatal error: Using $this when not in object context in /home/vhosts/globolwarfare.e2uhosting.com/testphp/php/main_ond.php on line 24

    PHP Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
            <style type="text/css" media="screen"><!--
    #layer1 { height: 370px; width: 560px; left: 260px; top: 150px; position: absolute; visibility: visible; }
    --></style>
        </head>

    <body>

    <?php
    session_start
    ();
    require(
    "config.php");
    ?>
    <a href="main_newtopic.php" target="forummenu">New Topic</a><br><br>
    <table border=1 cellpadding=0 cellspacing=0 width="50%">
    <th class="kop" colspan="4"><h1>Main Forum</h1></th>
    <tr><td class="sub">&nbsp;</td><td>Topic</td><td>Replies</td><td class="sub">&nbsp;</td></tr>
    <?
    $eind 
    5;
    $a = ($nav*$eind)-$eind;

    $this->pages $totaal $eind
    $this->pages ceil($this->pages);
    $dbres mysql_query("SELECT * FROM main_topics ORDER BY id ASC LIMIT $a,$eind");
    while(
    $topic mysql_fetch_array($dbres)){
    $sqldb mysql_query("SELECT * FROM main_replies WHERE topic_id='$topic[id]'");
    $replies mysql_num_rows($sqldb);
    ?>
    <tr><td class="sub">&nbsp;</td><td><a target="content" href="main_viewtopic.php?topic_id=<?=$topic['id']; ?>&nav=1"><?=$topic['title']; ?></a></td><td><?=$replies?></td><td class="sub">&nbsp;</td></tr>
    <?
    }
    ?>
    </table>
    <br><br>
    <table border=1 cellpadding=0 cellspacing=0 width="50%">
    <tr><td>
    <?

    if($nav == OR $nav 1){
    echo 
    "Previous";
    }else{
    ?>
    <a href="">Previous</a><?}?>                                     <a href="">Next</a><br>
    </td></tr></table>

    </body>
    </html></div>
        </body>
    </html>

  • #2
    Well, the error states the problem: You use $this out of object context. (You cannot declare a variable with name "$this")

    If you want to use an object of a class you must instantiate it before you can access its methods and properties:
    PHP Code:
    class SomeClass {
      public 
    $anything 'x';
      public function 
    something() {
        
    // ...
      
    }
      
    //...
    }

    $someClassObj = new SomeClass();
    $someClassObj->anything 'X';
    $someClassObj->something(); 
    dumpfi
    Last edited by dumpfi; Aug 4, 2005, 07:34 AM.
    "Failure is not an option. It comes bundled with the software."
    ....../)/)..(\__/).(\(\................../)_/)......
    .....(-.-).(='.'=).(-.-)................(o.O)...../<)
    ....(.).(.)("}_("}(.)(.)...............(.)_(.))¯/.
    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
    Little did the bunnies suspect that one of them was a psychotic mass murderer with a 6 ft. axe.

    Comment


    • #3
      can someone show me where to put it or chage it for me

      Comment

      Working...
      X