Jump to content
MakeWebGames

Recommended Posts

Posted

Hello everyone,

I am unable to view all of the items in my inventory for some reason, except for weapons and armour. I believe that it is most likely to do with how it is connecting to the database, though I am unsure. Any help would be highly appreciated. P.S. This script is from GRPG, though I didn't know where to post it.

 

<?
include 'header.php';
if ($_GET['use'] == 14){ //if they are trying to use an awake pill
$result = mysql_query("SELECT * FROM `inventory` WHERE `userid`='".$user_class->id."' AND `itemid`='14'");
$howmany = mysql_num_rows($result);

if ($howmany > 0) {
	$result = mysql_query("UPDATE `grpgusers` SET `awake` = '".$user_class->maxawake."' WHERE `id`='".$_SESSION['id']."'");
	Take_Item(14, $user_class->id);//take away an awake pill
	echo Message("You popped an awake pill.");
}
}
?>
<tr><td class="contenthead">Your Inventory</td></tr>
<tr><td class="contentcontent">Everything you have collected.</td></tr>
<tr><td class="contenthead">Equipped</td></tr>
<tr><td class="contentcontent">
<table width='100%'>
<tr>
	<td width='50%' align='center'>
	<? if ($user_class->eqweapon != 0){?>
		[img=<?= $user_class->weaponimg ?>]

		<?= item_popup($user_class->weaponname, $user_class->eqweapon) ?>

		[url='equip.php?unequip=weapon'][unequip][/url]
	<? } else {
		echo "You don't have a weapon equipped.";
	   }
	?>
	</td>
	<td width='50%' align='center'>
	<? if ($user_class->eqarmor != 0){?>
		[img=<?= $user_class->armorimg ?>]

		<?= item_popup($user_class->armorname, $user_class->eqarmor) ?>

		[url='equip.php?unequip=armor'][unequip][/url]
	<? } else {
		echo "You don't have any armor equipped.";
	   }
	?>
	</td>
</tr>
</table>
</td></tr>
<?
$result = mysql_query("SELECT * FROM `inventory` WHERE `userid` = '".$user_class->id."' ORDER BY `userid` DESC");

while($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
$result2 = mysql_query("SELECT * FROM `items` WHERE `id`='".$line['itemid']."'");
   $worked2 = mysql_fetch_array($result2);

	if ($worked2['offense'] > 0){
	$sell = ($worked2['cost'] > 0) ? "[url='sellitem.php?id=".$worked2['][sell][/url]" : "";
	$weapons .= "

	<td width='25%' align='center'>

	[img=". $worked2[]

	". item_popup($worked2['itemname'], $worked2['id']) ." [x".$line['quantity']."]

	$". $worked2['cost'] ."

	$sell [url='putonmarket.php?id=".$worked2['][Market][/url] [url='senditem.php?id=".$worked2['][send][/url] [url='equip.php?eq=weapon&id=".$worked2['][Equip][/url]
	</td>
	";
	}

	if ($worked2['defense'] > 0){
	$sell = ($worked2['cost'] > 0) ? "[url='sellitem.php?id=".$worked2['][sell][/url]" : "";
	$armor .= "

	<td width='25%' align='center'>

	[img=". $worked2[]

	". item_popup($worked2['itemname'], $worked2['id']) ." [x".$line['quantity']."]

	$". $worked2['cost'] ."

	$sell [url='putonmarket.php?id=".$worked2['][Market][/url] [url='senditem.php?id=".$worked2['][send][/url] [url='equip.php?eq=armor&id=".$worked2['][Equip][/url]
	</td>
	";
	}

	if ($worked2['id'] == 14){
	$misc .= "

	<td width='25%' align='center'>

	[img=". $worked2[]

	". $worked2['itemname'] ." [x".$line['quantity']."]

	[url='inventory.php?use=14'][use][/url] [url='putonmarket.php?id=".$worked2['][Market][/url] [url='senditem.php?id=".$worked2['][send][/url]
	</td>
	";
	}
}

//check for drugs
	if ($user_class->cocaine != 0){
		$drugs .= "

		<td width='25%' align='center'>

		[img=images/noimage.png]

		Cocaine [x".$user_class->cocaine."]

		$0

		[url='drugs.php?use=cocaine'][use][/url]
		</td>
		";
	}
	if ($user_class->nodoze != 0){
		$drugs .= "

		<td width='25%' align='center'>

		[img=images/noimage.png]

		No-Doze [x".$user_class->nodoze."]

		$0

		[url='drugs.php?use=nodoze'][use][/url]
		</td>
		";
	}
	if ($user_class->genericsteroids != 0){
		$drugs .= "

		<td width='25%' align='center'>

		[img=images/noimage.png]

		Generic Steroids [x".$user_class->genericsteroids."]

		$0

		[url='drugs.php?use=genericsteroids'][use][/url]
		</td>
		";
	}
//check for drugs
if ($weapons != ""){
?>
<tr><td class="contenthead">Weapons</td></tr>
<tr><td class="contentcontent">
<table width='100%'>
			<tr>
			<? echo $weapons; ?>
			</tr>
		</table>
</td></tr>
<?
}
if ($armor != ""){
?>
<tr><td class="contenthead">Armor</td></tr>
<tr><td class="contentcontent">
<table width='100%'>
			<tr>
			<? echo $armor; ?>
			</tr>
		</table>
</td></tr>
<?
}


if ($misc != ""){
?>
<tr><td class="contenthead">Misc.</td></tr>
<tr><td class="contentcontent">
<table width='100%'>
			<tr>
			<? echo $misc; ?>
			</tr>
		</table>
</td></tr>
<?
}

if ($drugs != ""){
?>
<tr><td class="contenthead">Drugs</td></tr>
<tr><td class="contentcontent">
<table width='100%'>
			<tr>
			<? echo $drugs; ?>
			</tr>
		</table>
</td></tr>
<?
}
include 'footer.php'
?>

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...