Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

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
Trades: 0
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
 
 
Register now for full access!
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:
Cross-domain AJAX with JSONP
Posts: 3,110
Location: Toronto, Ontario
Trades: 0
$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 ?
__________________

Please login or register to view this content. Registration is FREE
- Latest Articles:
Please login or register to view this content. Registration is FREE
,
Please login or register to view this content. Registration is FREE

--
Please login or register to view this content. Registration is FREE

Christopher is offline
Reply With Quote
View Public Profile
 
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:
JAMISONTUNES
Posts: 2,918
Name: Keith Marshall
Location: Connecticut
Trades: 0
$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
Trades: 0
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 Search this Thread
Search this Thread:

Advanced Search

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

BB 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.14810 seconds with 12 queries