Jump to content

help please....


seany123

Recommended Posts

basically i have this code.

 

<div class="g_content"><h3>  Weapons</h3><div class="g_text">
<table align='center' cellspacing='10'>
<?php

$current_col = 1;
$max_col = 4;


$query = $db->execute("select * from items where `player_id`=?", array($player->id));
while($item = $query->fetchrow())
{	
$query2 = $db->execute("select * from `blueprint_items` where `id`=?",array($item['item_id']));
$item2 = $query2->fetchrow();
if($item2['type'] == 'weapon'){
if($item['status'] != 'equipped'){	
    //Open new row if first column
    if($current_col==1)
    {
        echo "<tr>\n";
    }	

    //Display current record

    echo "<td>";
echo "<center><img src=\"{$item2['img']}\" width='80' height='80' style=\"border: 1px solid #CC9900\"></center>";
    echo "<center><a href=\"../description.php?id={$item2['id']}\">{$item2['name']}</a></center>";
echo "<center>[<a href='../item.php?sell=".$item['id']."'>Sell</a>] [<a href='../item.php?market=".$item['id']."'>Market</a>] <br>[<a href='../item.php?send=".$item['id']."'>Send</a>] [<a href='../item.php?equip=".$item['id']."'>Equip</a>]</center><br>";
    echo "</td>\n";
 //Close row if last column
    if($current_col==$max_col)
    {
        echo "<tr>\n";
        $current_col = 0;  //<---Changed
    }
    $current_col++;
}
}
}
//Close last row if needed
if ($current_col!=1)
{
    for(; $current_col<=$max_col; $current_col++)
    {
        echo "<td> </td>\n";
    }
}

?>
</table>
</div></div>

 

what i wanna do is make it so if more than one $item->item_id that is the same is found... then to only show 1 but have it echo the amount found...

 

so say i have 5 rows with the same $item->item_id.. it will only echo 1 row but then echo Quantity: 5

Link to comment
https://forums.phpfreaks.com/topic/167888-help-please/
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.