• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Help in Market PHP system

esnio12

Member
Joined
Oct 2, 2010
Messages
59
Reaction score
13
Hello everyone, i want a help in this code, i want to put a search box for filter items by name, anyone know how i can do this?

This is a market PHP, when the players use a talkaction and send a item for db, and at this site they can see the offer id and buy in-game.

sorry for my bad english,

thanks for the help

Follow the code
PHP:
<?php
$page = 0;
if(isset($_REQUEST['page']))
    $page = min(50, $_REQUEST['page']);

$main_content .= '   

</table>
<br>
<hr>
<div style="text-align: center;"><span style="font-size: xx-large;"><strong>Market</strong></span></div>
<br>
<table style="background-color:white" width="800" border="1" cellpadding="1" cellspacing="1">
<tr>
    <th style="background-color:white; color: black; text-align:center">ID</th>
    <th style="background-color:white; color: black; text-align:center">Item</th>
    <th style="background-color:white; color: black; text-align:center">Nome</th>
    <th style="background-color:white; color: black; text-align:center">Refino</th>
    <th style="background-color:white; color: black; text-align:center">Quantidade</th>
    
    <th style="background-color:white; color: black; text-align:center">Valor</th>
    
</tr>

';

require 'conectdb.php';
$db = new Conexao();
$sql = 'SELECT * FROM item_market ORDER BY id';
$rs = $db->query($sql);

$resultados = $rs->fetchAll(PDO::FETCH_OBJ);

if($page == 0)
foreach ($resultados as $r) if ($tmp++ < 100)  {
       


echo $result;
$main_content .= '<tr>';
$main_content .= '<th style="background-color:white; color: black; text-align:center">'.$r->id.'</th>';
$main_content .= '<th style="background-color:white; text-align:center;color: black"><img src="images/equips/'.$r->itemid.'.png"/></th>';
$main_content .= '<th style="background-color:white; text-align:center;color: green">'.$r->itemname.'</th>';
$main_content .= '<th style="background-color:white; text-align:center;color: green">'.$r->itemrefino.'</th>';
$main_content .= '<th style="background-color:white; text-align:center;color: green">'.$r->itemquantidade.'</th>';
$main_content .= '<th style="background-color:white; text-align:center;color: black">'.$r->itemvalor.'</th>';
$main_content .= '</tr>';
}
if($page == 1)
    foreach ($resultados as $r) if ($tmp++ > 101) if ($tmp++ < 200)   {
$main_content .= '<tr>';
$main_content .= '<th style="background-color:white; color: black; text-align:center">'.$r->id.'</th>';
$main_content .= '<th style="background-color:white; text-align:center;color: black"><img src="images/equips/'.$r->itemid.'.png"/></th>';
$main_content .= '<th style="background-color:white; text-align:center;color: green">'.$r->itemname.'</th>';
$main_content .= '<th style="background-color:white; text-align:center;color: green">'.$r->itemrefino.'</th>';
$main_content .= '<th style="background-color:white; text-align:center;color: green">'.$r->itemquantidade.'</th>';
$main_content .= '<th style="background-color:white; text-align:center;color: black">'.$r->itemvalor.'</th>';
$main_content .= '</tr>';
}
if($page == 2)
    foreach ($resultados as $r) if ($tmp++ > 201) if ($tmp++ < 300)   {
$main_content .= '<tr>';
$main_content .= '<th style="background-color:white; color: black; text-align:center">'.$r->id.'</th>';
$main_content .= '<th style="background-color:white; text-align:center;color: black"><img src="images/equips/'.$r->itemid.'.png"/></th>';
$main_content .= '<th style="background-color:white; text-align:center;color: green">'.$r->itemname.'</th>';
$main_content .= '<th style="background-color:white; text-align:center;color: green">'.$r->itemrefino.'</th>';
$main_content .= '<th style="background-color:white; text-align:center;color: green">'.$r->itemquantidade.'</th>';
$main_content .= '<th style="background-color:white; text-align:center;color: black">'.$r->itemvalor.'</th>';
$main_content .= '</tr>';
}
if($page == 3)
    foreach ($resultados as $r) if ($tmp++ > 301) if ($tmp++ < 400)   {
$main_content .= '<tr>';
$main_content .= '<th style="background-color:white; color: black; text-align:center">'.$r->id.'</th>';
$main_content .= '<th style="background-color:white; text-align:center;color: black"><img src="images/equips/'.$r->itemid.'.png"/></th>';
$main_content .= '<th style="background-color:white; text-align:center;color: green">'.$r->itemname.'</th>';
$main_content .= '<th style="background-color:white; text-align:center;color: green">'.$r->itemrefino.'</th>';
$main_content .= '<th style="background-color:white; text-align:center;color: green">'.$r->itemquantidade.'</th>';
$main_content .= '<th style="background-color:white; text-align:center;color: black">'.$r->itemvalor.'</th>';
$main_content .= '</tr>';
}
if($page == 4)
    foreach ($resultados as $r) if ($tmp++ > 401) if ($tmp++ < 500)   {
$main_content .= '<tr>';
$main_content .= '<th style="background-color:white; color: black; text-align:center">'.$r->id.'</th>';
$main_content .= '<th style="background-color:white; text-align:center;color: black"><img src="images/equips/'.$r->itemid.'.png"/></th>';
$main_content .= '<th style="background-color:white; text-align:center;color: green">'.$r->itemname.'</th>';
$main_content .= '<th style="background-color:white; text-align:center;color: green">'.$r->itemrefino.'</th>';
$main_content .= '<th style="background-color:white; text-align:center;color: green">'.$r->itemquantidade.'</th>';
$main_content .= '<th style="background-color:white; text-align:center;color: black">'.$r->itemvalor.'</th>';
$main_content .= '</tr>';
}
if($page >= 5)
    foreach ($resultados as $r) if ($tmp++ > 501) if ($tmp++ < 600)   {
$main_content .= '<tr>';
$main_content .= '<th style="background-color:white; color: black; text-align:center">'.$r->id.'</th>';
$main_content .= '<th style="background-color:white; text-align:center;color: black"><img src="images/equips/'.$r->itemid.'.png"/></th>';
$main_content .= '<th style="background-color:white; text-align:center;color: green">'.$r->itemname.'</th>';
$main_content .= '<th style="background-color:white; text-align:center;color: green">'.$r->itemrefino.'</th>';
$main_content .= '<th style="background-color:white; text-align:center;color: green">'.$r->itemquantidade.'</th>';
$main_content .= '<th style="background-color:white; text-align:center;color: black">'.$r->itemvalor.'</th>';
$main_content .= '</tr>';
}

$main_content .= '</table>';

if($page >= 1)
                        $main_content .= '
                            <TR>
                                <TD WIDTH=100% ALIGN=right VALIGN=bottom>
                                    <A HREF="?subtopic=market&list='.urlencode($list).'&page='.($page - 1).'" CLASS="size_xxs">Previous Page</A>
                                </TD>
                            </TR>';    
if($page < 5)    
                        $main_content .= '
                            <TR>
                                <TD WIDTH=100% ALIGN=right VALIGN=bottom>
                                    <A HREF="?subtopic=market&page='.($page + 1).'" CLASS="size_xxs">Next Page</A>
                                </TD>
                            </TR>';                            
if($page >= 5)    
$main_content .= 'Pagina limite.';        
?>
 
Top