Jump to content

[SOLVED] need help modifying code.


darkfreaks

Recommended Posts

Okay so in the following code it is set to display all items in a loop however it does not search for multiple items and just say you have 5 hounddogs instead it says you have

 

houndog,houndog,houndog,houndog,houndog. <------------- this is rather annoying me.

 

 

id rather have it the other way any ideas?

 

 

while ($array = mysql_fetch_array($query))
{
$get_item = fetch("SELECT * FROM items2 WHERE id = '$array[item_id]' AND game = '$game'");
$id = $get_item[id];
if ($get_item[retired] == 1)
{
	$retired[$id] = "<br><font color=White><b>(RETIRED)</b></font>";
}

$y = $x % 5;
if ($y == 0)
{
	echo "<tr>";
}
echo 
"<td><p align=center><a href=useitems.php?game=$game&id=$array[id]><img src=$base_url/images/user_images/opg_$game/items/item_$get_item[id].gif>
<br><b>$get_item[item_name]</b></a><br><i>($array[parts_left]/$get_item[parts] parts)</i>$retired[$id]</p></td>";
if ($y == 10)
{
	echo "</tr>";
}
$x++;
}

if ($x == 0)
{
$findGotten = fetch("SELECT * FROM starter_packs_gotten WHERE userid = '$userid' AND game = '$game'");
$findKit = fetch("SELECT * FROM starter_items WHERE game = '$game'");
if (($findGotten[id]) OR (!$findKit[id]))
{
	print "<br/><hr><center>Sorry, You have no items, why not check out the <a href=$base_url/shops.php?game=$game>Shops</a> !.</center><hr><p>";
}
else
{
	print "<tr><td><p align=center><a href=get_starter.php?game=$game>Click here to get a starter kit!!</a></p></td></tr>";
}
}

echo "</td></table>
";

if ($numitems > $max)
{
echo "<div style='padding-top:20px;'><center><form action='$base_url/myitems.php?game=$game&min=$max' method='post'><input type='submit' value='Next 50'></form></center></div>";
}
if ($min != 0)
{
$prev_min = $min - 50;
echo "<div style='padding-top:20px;'><center><form action='$base_url/myitems.php?game=$game&min=$prev_min' method='post'><input type='submit' value='Previous 50'></form></center></div>";
}
echo $closeHTML;

?>

Link to comment
https://forums.phpfreaks.com/topic/106654-solved-need-help-modifying-code/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.