Jump to content
MakeWebGames

Does anyone know


mixmaster

Recommended Posts

Well just create a dropdown in html and retrieve the data from the databases. I don't know how mccodes code is structured so I can't really help you with that. Also as far as having too many items per dropdown. Make an individual dropdown for each i.e. one for weapons, one for armor, etc, etc,

Link to comment
Share on other sites

I'm guessing something like:

 

<td valign=top>Inventory:</td>
<td>
<?php
$sql_query=("SELECT itmname FROM inventory WHERE userid=$userid");
echo "<select name='item'>";
if(mysql_num_rows($sql_query)) 
{ 
while($row = mysql_fetch_assoc($sql_query)) 
	{ 
	echo "<option>$row[itmname]</option>"; 
	}
}
else 
{
echo "<option>No Items In Inventory!</option>";  
}
?>
   </td>
   </tr>   
Link to comment
Share on other sites

Hope this helps..

Add to global_func.php

 

function inv_item_dropdown($connection,$ddname="userinv",$selected=-1)
{
global $db,$r,$ir;
$ret="<select name='$ddname' type='dropdown'>";
$q=$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=".$ir['userid']."");
if($selected == -1) { $first=0; } else { $first=1; }
while($r=$db->fetch_row($q))
{
$ret.="\n<option value='{$r['itmname']}'";
if ($selected == $r['itmname'] || $first == 0) { $ret.=" selected='selected'";$first=1; } 
$ret.=">{$r['itmname']} <b>You Have ({$r['inv_qty']}) Of This Item</b></option>";
}
$ret.="\n</select>";
return $ret;
}

 

then add anywhere near top of inventory.php

 

print "<h3>Inventory Quick View</h3><br />
".inv_item_dropdown($c,'userinv')."<br />";

 

Should list Items you have by name and Quantity

Edited by illusions
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...