I did not make this, I found it on the forums somewhere a while ago, and then I edited it to fit my needs, and added a little extra, as the pages function and such. Use it however you want, just don't sell it or anything like that. If you want to change how many displayed items there are per page, just edit the $rowsPerPage variable. Default is 30. Here is the code.
Save as encyclopedia.php
<?php
include "globals.php";
print "
<font color='#FFFFFF'><hr width='95%'><h3>Item Encyclopedia</h3></font><hr width='95%'/>";
$sql1 = $db->query("SELECT * FROM items");
$count = $db->num_rows($sql1);
$rowsPerPage = 30;
$numrows = $db->num_rows($sql1);
$pageNum = 1;
if(isset($_GET['page']))
{
$pageNum = $_GET['page'];
}
$offset = ($pageNum - 1) * $rowsPerPage;
$maxPage = ceil($numrows/$rowsPerPage);
print"
<table width='95%' cellspacing='1' border='0'>
<tr>
<td width='15%'>
[b]Item Type[/b]
</td>
<td width='15%'>
[b]Item Name[/b]
</td>
<td width='40%'>
[b]Description[/b]
</td>
<td>
[b]Buy Price[/b]
</td>
<td>
[b]Sell Price[/b]
</td>
<td>
[b]Owned by:[/b]
</td>
</tr>";
$q=$db->query("SELECT i.*,it.itmtypename FROM items i JOIN itemtypes it ON i.itmtype=it.itmtypeid ORDER BY i.itmtype,i.itmbuyprice ASC LIMIT $offset, $rowsPerPage");
$cn=0;
while($p=$db->fetch_row($q))
{
$d=$db->query("SELECT inv_userid FROM inventory where inv_itemid={$p['itmid']} GROUP BY inv_userid");
$r=$db->num_rows($d);
$cn++;
$buy = number_format($p['itmbuyprice']);
$sell = number_format($p['itmsellprice']);
print"
<tr>
<td>
{$p['itmtypename']}
</td>
<td>
[url='iteminfo.php?ID={$p[']{$p['itmname']}[/url]
</td>
<td>
{$p['itmdesc']}
</td>
<td>
\$$buy
</td>
<td>
\$$sell
</td>
<td>
$r players
</td>
</tr>";
}
print "
<tr>
<td align='center' colspan='6'>
[b]Pages: [/b]";
for($page = 1; $page <= $maxPage; $page++)
{
$nav .= "[url='encyclopedia.php?page={$page}']$page, [/url]";
}
print "
$nav
</td>
</tr>
</table>";
print "
<hr width='95%'>[url='index.php']Back[/url]
<hr width='95%'>";
$h->endpage();
?>
Enjoy!
Might also add what it does: It creates a list of all the items you have on your game, with name, description, buy and sell price, and how many users own it.