<?php
require 'sessionend.php';
require "adminpage.php";
$style="";
$table="";
$count=0;
$page=1;
if (isset($_GET['Page'])){$page=$_GET['Page'];}
//Coneccion de Base de Datos
require("Sqlserverinfo.php");
include "Pagingscript.php";
// Obtener información para todas las empresas en la base de datos, y el número de usuarios de pertenecer a cada uno.
$sql="SELECT Dealer, City, Country, DealerID,Crimp,Software,Progcbl,BTDongle FROM authorized_dealer order by Dealer";
list($paging,$sql,$total)=GetPaging($page,$sql,9,$ _SERVER['PHP_SELF']);
$result=SqlExecute($sql);
$table="<tr><th></th><th>Dealer</th><th>City</th><th>Country</th><th>Users</th><th>Crimp</th><th>Software</th><th>Prog Cbl</th><th>BT Dongle</th></tr>";
// Devolver también botones de selección para todos los campos
while ($row = SqlRetrieveRow($result)) {
$style="";
$Dealerid=$row['DealerID'];
$sql="Select COUNT(*) from dealer_login where $Dealerid=DealerID";
$rowcount = SqlExecute($sql);
if ($rows=SqlRetrieveRow($rowcount))
{
$logcount=$rows[0];
if ($logcount>0)
{
$logcount=$logcount." registered users";
$style=" style=\"background-color:#47A3FF;;\"";
}
else
{
$logcount="No registed users";
}
}
$crimp=$row['Crimp'];
if ($crimp=='1')
{
$crimp="<td style=\"background-color:Green;\"><input type=\"checkbox\" disabled=\"disabled\" checked=\"checked\"/></td>";
}
else
{
$crimp="<td style=\"background-color:Red;\"><input type=\"checkbox\" disabled=\"disabled\" /></td>";
}
$software=$row['Software'];
if ($software=='1')
{
$software="<td style=\"background-color:Green;\"><input type=\"checkbox\" disabled=\"disabled\" checked=\"checked\"/></td>";
}
else
{
$software="<td style=\"background-color:Red;\"><input type=\"checkbox\" disabled=\"disabled\" /></td>";
}
$prog=$row['Progcbl'];
if ($prog=='1')
{
$prog="<td style=\"background-color:Green;\"><input type=\"checkbox\" disabled=\"disabled\" checked=\"checked\"/></td>";
}
else
{
$prog="<td style=\"background-color:Red;\"><input type=\"checkbox\" disabled=\"disabled\" /></td>";
}
$blue=$row['BTDongle'];
if ($blue=='1')
{
$blue="<td style=\"background-color:Green;\"><input type=\"checkbox\" disabled=\"disabled\" checked=\"checked\"/></td>";
}
else
{
$blue="<td style=\"background-color:Red;\"><input type=\"checkbox\" disabled=\"disabled\" /></td>";
}
$count++;
//Paramatros devueltos
$rowclass="select".$count;
$table.="<tr id='".$rowclass."'><td><Input onclick=\"Selector('".$rowclass."','".$row['DealerID']."')\" type='Button' Name='Select' Value='Select'></td>
<td>".$row['Dealer']."</td><td>".$row['City']."</td><td>".$row['Country']."</td><td".$style.">".$logcount."</td>".$crimp.$software.$prog.$blue."</tr>";
}
$table="<table id=\"invoices\" border='1' class=\"Styletable divcenter\">".$table."</table>";
$count=$count." entries found";
$total=$total." entries in total";
?>
Y en el html solo imprimo $paging; para el n'umero de botones de p'aginas y la tabla.
<div id="Text" class="Extend center">
<form id="pg" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<?php if(isset($paging)){echo $paging;}?>
</form>
<br />
<?php if(isset($count)){echo $count;}?>
<br />
<?php if(isset($total)){echo $total;}?>
<br />
<br />
<form id="snd" action="DealerDetail.php" method="POST">
<input type="hidden" id="m" name="mode"/>
<input type="hidden" id="dealerid" name="DealerSearch"/>
</form>
<input type="hidden" id="lastid"/>
<table class="divcenter" align="center">
<tr><td><Input onclick="goView()" id="v" type='Button' Name='Submit' Value='View'></td>
<td style="padding:0px 50px;"><a href="Dealersearch.php">Back</a></td>
<td><Input onclick="goEdit()" id="e" type='Button' Name='Submit' Value='Edit'></td></tr>
</table>
<br />
<center>
<?php if(isset($table)){echo $table;}?>
</center>
</div>
![](http://dtiguardian.com/tablas.png)