Jump to content
MakeWebGames

possible Items shown in veiwuser(missing something?)


Recommended Posts

Posted

Okay i dont know if anyone would even want anything like this, and yes i know this should be simple.

all i was trying to do was have the items in the user you are viewings inventory show on the bottom of the page.

i think im close to having it, but i just cant seem to get it to work right.

either way here is where im at now.

[mysql]$inv=$db->query("SELECT iv.*,i.*,it.* FROM inventory iv LEFT JOIN items i ON iv.inv_itemid=i.itmid LEFT JOIN itemtypes it ON i.itmtype=it.itmtypeid WHERE iv.inv_userid={$r['userid']} ORDER BY i.itmtype ASC");

if ($db->num_rows($inv) == 0)

{

print "User has no items";

}

else

{

print "<table width=90% class=\"table\" border=\"0\" cellspacing=\"1\">

if ($r['inv_qty'] > 1)

{

print"<tr><td>{$inv[";

}

print "</td></tr></table>";

}

$h->endpage();

?>[/mysql]

is what i have as my ending code in viewuser.php

but. parse error you likely see. lol

i have been up way to long, im just spent i guess. :wacko:

any tips on how i can make this work?

some may want to use if it would work, just though id throw it our here.

Posted

Okay i have fixed the error and straightend it up a little, but still not working. lol

[mysql]$inv=$db->query("SELECT iv.*,i.*,it.* FROM inventory iv LEFT JOIN items i ON iv.inv_itemid=i.itmid LEFT JOIN itemtypes it ON i.itmtype=it.itmtypeid WHERE iv.inv_userid={$r['userid']} ORDER BY i.itmtype ASC");

if ($db->num_rows($inv) == 0)

{

print "User has no items";

}

else

{

if ($r['inv_qty'] > 1)

{

print "<table width=90% class=\"table\" border=\"0\" cellspacing=\"1\">

<tr>

<td>

{$i[

</td>

</tr>

</table>";

}

}

$h->endpage();

?>[/mysql]

think i need :sleeping: been up way to long.

Posted

Okay i fixed it with this added to the end on my viewuser.php lol was missing quite a bit the first go round.

[mysql]$inv=$db->query("SELECT iv.*,i.*,it.* FROM inventory iv LEFT JOIN items i ON iv.inv_itemid=i.itmid LEFT JOIN itemtypes it ON i.itmtype=it.itmtypeid WHERE iv.inv_userid={$r['userid']} ORDER BY i.itmtype ASC");

if ($db->num_rows($inv) == 0)

{

print "User has no items";

}

else

{

print "<table width=100% class=\"table\" border=\"0\" cellspacing=\"1\">";

$lt="";

while($i=$db->fetch_row($inv))

{

if($lt!=$i['itmtypename'])

{

$lt=$i['itmtypename'];

print "\n<tr><td>{$lt}</td></tr>";

}

if ($i['inv_qty'] > 1)

print"</td><td>{$i[";

}

}

$h->endpage();

?>[/mysql]

Posted

still one little issue with this, the items are displayed across the page, and the more you have the further it widens the page to display the items.

so use at your own risk as it is now.

Posted
$inv=$db->query("SELECT iv.*,i.*,it.* FROM inventory iv LEFT JOIN items i ON iv.inv_itemid=i.itmid LEFT JOIN itemtypes it ON i.itmtype=it.itmtypeid WHERE iv.inv_userid={$r['userid']} ORDER BY i.itmtype ASC");
if ($db->num_rows($inv) == 0)
{
print "User has no items";
}
else
{
print "<table width=75% class=\"table\" border=\"0\" cellspacing=\"1\">";
$lt="";
while($i=$db->fetch_row($inv))
{
if($lt!=$i['itmtypename'])
{
$lt=$i['itmtypename'];
print "\n<tr><td>[b]{$lt}[/b]</td></tr>";
}
if ($i['inv_qty'] > 1)
print"</td><td>[img=itmpics/{$i[]";
}
}
$h->endpage();
?>
Posted

already tried that one. 100% down to 75% does nothing different, not even going down to 5%.

i was so focused on getting the dang pics to show i didnt think about how they would be shown.

Posted

$inv=$db->query("SELECT iv.*,i.*,it.* FROM inventory iv LEFT JOIN items i ON iv.inv_itemid=i.itmid LEFT JOIN itemtypes it ON i.itmtype=it.itmtypeid WHERE iv.inv_userid={$r['userid']} ORDER BY i.itmtype ASC");
if ($db->num_rows($inv) == 0)
{
print "User has no items";
}
else
{
print "<table width=100% class=\"table\" border=\"0\" cellspacing=\"1\">";
$lt="";
$totitems=0;
print"<tr>";
while($i=$db->fetch_row($inv))
{
	if($lt!=$i['itmtypename'])
	{
		$totitems++;
		$lt=$i['itmtypename'];
		print "<td>[b]{$lt}[/b]</td>";
		if($totitems%3==0)
		{
			print"</tr><tr>";
		}
	}
	if ($i['inv_qty'] > 1)
	print"</td><td>[img=itmpics/{$i[]";
}
print"</tr></table>";
}
$h->endpage();
?>

fixed. (Untested)

Posted

Sorry, i seen i forgot to close the tags, but that wasnt it either. i corrected that earlier thinking *what a bonehead thing to leave off* but nope.

and

[mysql]$inv=$db->query("SELECT iv.*,i.*,it.* FROM inventory iv LEFT JOIN items i ON iv.inv_itemid=i.itmid LEFT JOIN itemtypes it ON i.itmtype=it.itmtypeid WHERE iv.inv_userid={$r['userid']} ORDER BY i.itmtype ASC");

if ($db->num_rows($inv) == 0)

{

print "User has no items";

}

else

{

print "<table width=100% class=\"table\" border=\"0\" cellspacing=\"1\">";

$lt="";

$totitems=0;

print"<tr>";

while($i=$db->fetch_row($inv))

{

if($lt!=$i['itmtypename'])

{

$totitems++;

$lt=$i['itmtypename'];

print "<td>{$lt}</td>";

if($totitems%3==0)

{

print"</tr><tr>";

}

}

if ($i['inv_qty'] > 1)

print"</td><td>{$i[";

}

print"</tr></table>";

}

$h->endpage();

?>

[/mysql]

just makes it worse. with that the item groups will not only go across the page if the user has more than five, but it does not divide the groups up at all, they would just be displayed in a line along the bottom of the page.

But thx for the go at it.

i will get this to work eventually.

Posted
Why do you want their whole inv on their viewuser, i think its silly, but thats just me

 

^ matter of opinion, and game type plays into the equation as well.

I am not looking for a typical crime game. There would be no adverse effect to the users seeing the others inventory in my case. others may not like this.

silly even for some, but its something i wanted for mine.

 

But mainly i am trying to learn, and i got it so far but am now stuck.

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