Mcfarlin Posted November 20, 2009 Posted November 20, 2009 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>"; } 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. Quote
Mcfarlin Posted November 20, 2009 Author Posted November 20, 2009 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> </td> </tr> </table>"; } } $h->endpage(); ?>[/mysql] think i need :sleeping: been up way to long. Quote
Mcfarlin Posted November 20, 2009 Author Posted November 20, 2009 lol may be a noob to this, but yes i have the item pics. they work fine no problems, i have managed to get them to show everywhere i wanted them to show but here. Quote
Mcfarlin Posted November 20, 2009 Author Posted November 20, 2009 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>"; } } $h->endpage(); ?>[/mysql] Quote
Mcfarlin Posted November 20, 2009 Author Posted November 20, 2009 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. Quote
Gucci Mane Posted November 20, 2009 Posted November 20, 2009 $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(); ?> Quote
Mcfarlin Posted November 20, 2009 Author Posted November 20, 2009 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. Quote
rulerofzu Posted November 20, 2009 Posted November 20, 2009 Probably due to you have a open tags in the html for the item pics. Close the tags in that print"</td><td>[img=itmpics/{$i[]</td>"; Quote
seanybob Posted November 20, 2009 Posted November 20, 2009 $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) Quote
Mcfarlin Posted November 21, 2009 Author Posted November 21, 2009 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>"; } 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. Quote
Danny696 Posted November 21, 2009 Posted November 21, 2009 Why do you want their whole inv on their viewuser, i think its silly, but thats just me Quote
Mcfarlin Posted November 21, 2009 Author Posted November 21, 2009 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. Quote
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.