Jump to content
MakeWebGames

Error help


Legaci

Recommended Posts

Fatal error: Call to a member function endpage() on a non-object in /home/bravelan/public_html/display.php on line 38

 

function display()
  {
  global $ir;
  echo "<center><main>Display Case</main><hr width = '750px'>";
  $_GET['XID'] = abs(intval($_GET['XID']));
  if(!$_GET['XID'])
  {
    echo "Invalid ID<br/>
    <hr width='750px'>><a href='display.php'>Back</a><hr width='750px'>";
   $h->endpage();
   exit();

 

if i remove the

$h->endpage();
exit();

 

it calls an invalid ID

 

fixing solutions would be greatful thank you ???

Edited by Legaci
Link to comment
Share on other sites

Your code is incomplete

 

function display()
{
   global $ir;
   echo "<center><main>Display Case</main><hr width = '750px'>";
   $_GET['XID'] = abs(intval($_GET['XID']));
   if(!$_GET['XID'])
   {
       echo "Invalid ID
       <hr width='750px'>><a href='display.php'>Back</a><hr width='750px'>";
       $h->endpage();
       exit();

 

Your missing 2 brackets and $h isn't declared as a global, due to it being used in a function you need it so this is the correct part

 

function display()
{
   global $ir, $h;
   echo "<center><main>Display Case</main><hr width = '750px'>";
   $_GET['XID'] = abs(intval($_GET['XID']));
   if(!$_GET['XID'])
   {
       echo "Invalid ID
       <hr width='750px'>><a href='display.php'>Back</a><hr width='750px'>";
       $h->endpage();
       exit();

 

However you still need to post the fill function to help/

Link to comment
Share on other sites

function display()
{
   global $ir, $h;
   echo "<center><main>Display Case</main><hr width = '750px'>";
   $_GET['XID'] = abs(intval($_GET['XID']));
   if(!$_GET['XID'])
   {
       echo "Invalid ID
       <hr width='750px'>><a href='display.php'>Back</a><hr width='750px'>";
       $h->endpage();
       exit();

  }
  else
  {
    $query = array();
    $db->query("SELECT `display_case`
             FROM `users_extra`
             WHERE `playerid` = '".mysql_real_escape_string($_GET['XID'])."'
             AND `display_case` = 'yes'");
    $plys = array();
    $plys = $db->query($q_ry);
    if(!$db->num_rows($plys))
    {
       echo "Sorry, This user does not have a display case!<br/>
       <hr width='750px'>><a href=\"javascript:history.back();\">Back</a><hr width='750px'>";
       $h->endpage();
       exit();
    }
    else
    {
      if($_GET['XID'] == $ir['userid'])
      {
        echo "<b>><a href='display.php?action=add'>Add items</a> |
                 ><a href='display.php?action=remove'>Remove items</a></b><hr width = '750px'/>";
      }
      $py = array();
      $py = $db->fetch_row($plys);
      $query = array();
      $db->query("SELECT *
               FROM `player_display_items` pdi
               LEFT JOIN `items` i
               ON pdi.pdi_itemid = i.item_id
               WHERE pdi.pdi_playerid = '".mysql_real_escape_string($_GET['XID'])."'
               ORDER BY i.item_class ASC");
      $thishop = array();
      $thishop = $db->query($q_ry);
      echo "<table width = '100%' cellspacing='1'><tr>";
      if(!$db->num_rows($thishop))
      {
        echo "<tr><td align = 'center'>This person does not have any items in their display case.</td></tr></table>";
      }
      else
      {
        $ts = array();
        $num = 0;
        while($ts = $db->fetch_row($thishop))
        {
         $num++;
          echo "<td align = 'center'><b>",htmlentities($ts['item_name']),"</b><br/>
                (x ".number_format($ts['pdi_qty']).")<br/>
                <a href='iinfo.php?XID=".$ts['item_id']."'><img src='images/items/".$ts['item_picture']."' border='1'></a></td>";
          if($num == 3)
          {
           echo "</tr><tr>";
           $num=0; 
          }
        }
        echo "</table>";
      }
    }
  }
  }

 

ok so here it is

Link to comment
Share on other sites

Read your own code then. It clearly states

   if(!$_GET['XID'])
   {
       echo "Invalid ID
       <hr width='750px'>><a href='display.php'>Back</a><hr width='750px'>";
       $h->endpage();
       exit();

  }

 

So clearly there is no XID

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...