$inv =
$db->query(
"SELECT `inv_qty`, `itmsellprice`, `itmid`, `inv_id`,
`effect1_on`, `effect2_on`, `effect3_on`,
`weapon`, `armor`, `pet`, `head`, `itmtypename`, `itmdesc`, `itmpic`
FROM `inventory` AS `iv`
INNER JOIN `items` AS `i`
ON `iv`.`inv_itemid` = `i`.`itmid`
INNER JOIN `itemtypes` AS `it`
ON `i`.`itmtype` = `it`.`itmtypeid`
WHERE `iv`.`inv_userid` = {$userid}
ORDER BY `i`.`itmtype` ASC, `i`.`itmname` ASC");
$id = $db->fetch_row($inv);
//this is getting the img url so it should work if he fixes his markup