Reply
[HELP] Fatal error: Using $this when not in object context
Old 04-19-2007, 11:09 PM [HELP] Fatal error: Using $this when not in object context
Junior Talker

Posts: 2
what is Fatal error: Using $this when not in object context ??
Man... got this problem... can someone help me fix this?


*.inc code:
Line 58
PHP Code:
 if ($auth->userdata["acclevel"] < 80) die ("Access denied!");
?>
&nbsp;&nbsp;&nbsp;&nbsp;<img src="<?php echo $g_options["imgdir"]; ?>/downarrow.gif" width=9 height=6 border=0 align="middle" alt="downarrow.gif"><b>&nbsp;<?php echo $task->title?></b><p>
You can enter a player or clan ID number directly, or you can search for a player or clan.<p>
<table width="90%" align="center" border=0 cellspacing=0 cellpadding=0>
<tr valign="top">
 <td width="100%"><?php echo $g_options["font_normal"]; ?>&nbsp;<img src="<?php echo $g_options["imgdir"]; ?>/downarrow.gif" width=9 height=6 border=0 align="middle" alt="downarrow.gif"><b>&nbsp;Jump Direct</b><?php echo $g_options["fontend_normal"]; ?><p>
 
  <form method="GET" action="<?php echo $g_options["scripturl"]; ?>">
  <input type="hidden" name="mode" value="admin">
  <table width="100%" border=0 cellspacing=0 cellpadding=0>
 
  <tr>
   <td width="10%">&nbsp;</td>
   <td width="90%">
    <table width="40%" border=0 cellspacing=0 cellpadding=0>
 
    <tr valign="top" bgcolor="<?php echo $g_options["table_border"]; ?>">
     <td>
      <table width="100%" border=0 cellspacing=1 cellpadding=4>
 
      <tr valign="middle">
       <td nowrap width="45%" bgcolor="<?php echo $g_options["table_bgcolor1"]; ?>"><?php echo $g_options["font_normal"]; ?>Type:<?php echo $g_options["fontend_normal"]; ?></td>
       <td width="55%" bgcolor="<?php echo $g_options["table_bgcolor1"]; ?>">
        <?php
         
echo getSelect("task",
          array(
           
"tools_editdetails_player"=>"Player",
           
"tools_editdetails_clan"=>"Clan"
          
),
          
$this->type
         
);
        
?></td>
      </tr>
 
      <tr valign="middle">
       <td nowrap width="45%" bgcolor="<?php echo $g_options["table_bgcolor1"]; ?>"><?php echo $g_options["font_normal"]; ?>ID Number:<?php echo $g_options["fontend_normal"]; ?></td>
       <td width="55%" bgcolor="<?php echo $g_options["table_bgcolor1"]; ?>"><input type="text" name="id" size=15 maxlength=12 class="textbox"></td>
      </tr>
 
      </table></td>
     <td align="right">
      <table border=0 cellspacing=0 cellpadding=10>
      <tr>
       <td><input type="submit" value=" Edit &gt;&gt; " class="submit"></td>
      </tr>
      </table></td>
    </tr>
 
    </table></td>
  </tr>
 
  </table>
 
  </form><?php echo $g_options["fontend_normal"]; ?></td>
</tr>
</table><p>
<?php
 
require(INCLUDE_PATH "/search-class.inc");
 
 
$sr_query $HTTP_GET_VARS["q"];
 
$sr_type  $HTTP_GET_VARS["st"]
  or 
"player";
 
$sr_game  $HTTP_GET_VARS["game"];
 
 
$search = new Search($sr_query$sr_type$sr_game);
 
 
$search->drawForm(array(
  
"mode"=>"admin",
  
"task"=>$selTask
 
));
 
 if (
$sr_query)
 {
  
$search->drawResults(
   
"mode=admin&task=tools_editdetails_player&id=%k",
   
"mode=admin&task=tools_editdetails_clan&id=%k"
  
);
 }
?>
Thank you for your help!!!
JackL is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 04-19-2007, 11:12 PM Re: [HELP] Fatal error: Using $this when not in object context
Christopher's Avatar
Iced Cap

Latest Blog Post:
PHP and Unicode with UTF-8
Posts: 3,111
Location: Toronto, Ontario
$this can only be used from within a class and when the class has been instantiated. On line 58 you are doing $this->type, but you are not within a class context. Perhaps you mean $auth->type ?
Christopher is offline
Reply With Quote
View Public Profile Visit Christopher's homepage!
 
Old 04-19-2007, 11:15 PM Re: [HELP] Fatal error: Using $this when not in object context
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
Wireless Audio
Posts: 2,322
Name: Keith Marshall
Location: West Hartford, CT
$this is a reserved var to refer itself inside an object class - according to your sample, you probably want to change $this->type to $task->type
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Old 04-20-2007, 12:00 AM Re: [HELP] Fatal error: Using $this when not in object context
Junior Talker

Posts: 2
Thank you for all of your help!
$task->type worked.
I'm a busy person, I hope that I have more time to visit this forum.
JackL is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to [HELP] Fatal error: Using $this when not in object context
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.13342 seconds with 12 queries