Legaci Posted June 18, 2013 Share Posted June 18, 2013 (edited) 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 June 18, 2013 by Legaci Quote Link to comment Share on other sites More sharing options...
Guest Posted June 18, 2013 Share Posted June 18, 2013 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/ Quote Link to comment Share on other sites More sharing options...
Legaci Posted June 18, 2013 Author Share Posted June 18, 2013 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 Quote Link to comment Share on other sites More sharing options...
Guest Posted June 18, 2013 Share Posted June 18, 2013 Does it work like that since you added the $h? Quote Link to comment Share on other sites More sharing options...
Legaci Posted June 18, 2013 Author Share Posted June 18, 2013 no it now calls an invalid ID Quote Link to comment Share on other sites More sharing options...
Guest Posted June 18, 2013 Share Posted June 18, 2013 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 Quote Link to comment Share on other sites More sharing options...
Legaci Posted June 18, 2013 Author Share Posted June 18, 2013 thats what i thought ok thank you for your help Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.