Jump to content


Photo

[SOLVED] Help with PHP Error in game


  • Please log in to reply
No replies to this topic

#1 bazdog

bazdog
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 14 August 2006 - 12:57 AM

Okay, The game has an inventory system and everything that has worked forever, but then we switched to gem3 servers and everything has gone awry.

Okay here is the code:
<?

topImage('Inventory', 'playerInventory.php');

if(!isset($itemID) || $itemID == NULL)
{
  error("<b>Error:</b> no item ID given.");
}

$query = "SELECT qty, mod FROM data_iitems WHERE playerID = " . $GLOBALS['playerID'] . " && itemID = $itemID";
if(isset($mod) && $mod != "")
{
  $query .= " && mod = $mod";
}
$query = mysql_query($query, $handle);
if(!$query)
{
  error("<b>Error:</b> item cannot be found.");
}
$query = mysql_fetch_row($query);
$qty = $query[0];
      if($query[1] == NULL)
      {
  $mquery = "SELECT name, description, price, sorb FROM game_hitems WHERE ID = $itemID";
      }
      else
      {
        $mquery = "SELECT name, description, '???', sorb, pic FROM data_unique WHERE ID = $query[1]";
      }
$mquery = mysql_query($mquery, $handle);
if(!$mquery)
{
  error("<b>Error:</b> invalid item.");
}

  if($query[1] != NULL)
  {
    $pic = $mquery[4];
  }
  else
  {
    $pic = 'images/items/' . $itemID . '.gif';
  }
 
$item_info = mysql_fetch_row($mquery);

  print ("<table style=\"width:350px; font-size: 11px;\">");

  print ("<tr><td><img src=$pic></td><td><b>$item_info[0]</b> - $item_info[1] &nbsp; &nbsp; &nbsp; <br>Store Price: $$item_info[2] &nbsp;&nbsp;&nbsp; Quantity: $query[0]</td></tr><tr><td colspan=2><center>");
 
  switch($item_info[3])
  {
    case 0:
    case 1: print ("<form action=assignItem.php?itemID=$itemID&mod=$mod method=post> <select name=horseID>");
        $query = "SELECT id, name, breed FROM horse_info WHERE owner = " . $GLOBALS['playerID'];
        $query = mysql_query($query, $handle);
        while($row = mysql_fetch_row($query))
        {
          if($row[1] == "")
    {
        $row[1] = "*Unnamed*";
    }
          print ("<option value=$row[0]>$row[1], $row[2]");
    $check = 1;
        }
        if(!isset($check))
        {
          print ("<option style=\"font-color: gray; text-decoration: italics\">No horses");
        }
        print ("</select><input type=submit value=Assign></form>");
        break;
    case 2:
    case 3: print ("<form action=feedHorse.php?feed=$itemID method=post><select name=horseID>");
        $query = "select id, name, breed from horse_info where owner = " . $GLOBALS['playerID'];
        $query = mysql_query($query, $handle);
        while($row = mysql_fetch_row($query))
        {
          if($row[1] == "")
    {
        $row[1] = "*Unnamed*";
    }
    print ("<option value=$row[0]>$row[1], $row[2]");
    $check = 1;
        }
        if(!isset($check))
        {
          print ("<option style=\"font-color: gray; text-decoration: italics\">No horses");
        }
        print ("</select><input type=submit value=Feed></form>");
        break;
  }
  print ('</center><br><br></td></tr>');

  print ("</table>");

?>



When i remove the {
  $query .= " && mod = $mod";
} Part, feeding is enabled, BUT Tack still is down. Tack reads this with or without it, and feed reads it with it "Error: item cannot be found."

We have
PHP version  4.4.2
MySQL version 4.1.20-standard

Any help would be appeceriated





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users