Ciao momino, non vorrei approfittare della tua disponibilità però non riesco a capire il problema:?
Ti chiedo ancora un piccolo aiutino.
Lo script mi cerca i dati sempre sulla prima tabella,_ti posto il codice
[php]<?php
require ("../inc.php");
require ("../conn.php");
$chiave = $_POST['chiave'];
$campo = $_POST['campo'];
switch ($campo)
{
case "richiedente":
case "descrizione":
case "hardware":
case "sist_op":
case "pack":
case "rack":
case "fqdn":
case "alias_fqdn":
case "dns":
case "proxy":
case "porta":
case "operatore":
case "data":
$tabella = "host";
break;
case "macIF1":
case "macIF2":
case "macIF3":
case "macIFV":
case "connIF1":
case "connIF2":
case "connIF3":
case "connIFV":
case "IP_IF1":
case "IP_IF2":
case "IP_IF3":
case "IP_IFV":
case "netmask_IF1":
case "netmask_IF2":
case "netmask_IF3":
case "netmask_IFV":
case "gatewayIF1":
case "gatewayIF2":
case "gatewayIF3":
case "gatewayIFV":
case "lanDMZIF1":
case "lanDMZIF2":
case "lanDMZIF3":
case "lanDMZIFV":
case "rackIF1":
case "rackIF2":
case "rackIF3":
case "rackIFV":
case "patchIF1":
case "patchIF2":
case "patchIF3":
case "patchIFV":
case "switchIF1":
case "switchIF2":
case "switchIF3":
case "switchIFV":
case "portaIF1":
case "portaIF2":
case "portaIF3":
case "portaIFV":
case "data_rete":
case "operatore_rete":
$tabella = "rete";
break;
case "descrizione_sw":
case "versione":
case "data":
case "operatore":
$tabella = "sw_installato";
break;
case "source_host":
case "IPaddress":
case "protocollo":
case "porta":
case "data":
case "operatore":
$tabella = "sourcehost";
break;
case "destination_host":
case "IPaddress":
case "protocollo":
case "porta":
case "data":
case "operatore":
$tabella = "dhost";
break;
default: echo "non ci sono dati";
}
$query = "SELECT * FROM $tabella WHERE $campo='$chiave'";
$risultato = mysql_query($query);
//tab1
echo "<table border="1">
<tbody>";
while ($riga = mysql_fetch_array($risultato))
{
//stampa i risultati della ricerca
$richiedente=$riga["richiedente"];
$descrizione=$riga["descrizione"];
$hardware=$riga["hardware"];
$sist_op=$riga["sist_op"];
$pack=$riga["pack"];
$rack=$riga["rack"];
$fqdn=$riga["fqdn"];
$alias_fqdn=$riga["alias_fqdn"];
$dns=$riga["dns"];
$proxy=$riga["proxy"];
$porta=$riga["porta"];
$operatore=$riga["operatore"];
$data=$riga["data"];
$IDhost=$riga["IDhost"];
echo "
<tr><th colspan="4"> </th><th colspan="2" class="b">Eseguito</th>
<th class="larg"> </th></tr>
<tr><td colspan="4"> </td><td class="bold">Data</td><td class="bold">Operatore</td><td class="larg">ID</td></tr>
<tr><td class="bold">Richiedente</td><td colspan="3"> $richiedente</td>
<td rowspan="10"> $data</td>
<td rowspan="10"> $operatore</td>
<td rowspan="10" class="larg">$IDhost</td></tr>
<tr><td class="bold">Descrizione</td><td colspan="3"> $descrizione</td></tr>
<tr><td class="bold">Hardware</td><td colspan="3"> $hardware</td></tr>
<tr><td class="bold">Sistema operativo</td><td colspan="3"> $sist_op</td></tr>
<tr><td class="bold">Pack</td><td colspan="3"> $pack</td></tr>
<tr><td class="bold">Rack</td><td colspan="3"> $rack</td></tr>
<tr><td class="bold">FQDN</td><td colspan="3"> $fqdn</td></tr>
<tr><td class="bold">Alias FQDN</td><td colspan="3"> $alias_fqdn</td></tr>
<tr><td class="bold">DNS</td><td colspan="3"> $dns</td></tr>
<tr><td class="bold">PROXY</td><td> $proxy</td>
<td class="bold">PORTA</td><td> $porta</td></tr>";
}
echo "</tbody>";
echo "</table> <br /><br />";
//tab 2
echo "<table border="1">
<tbody>";
while ($riga = mysql_fetch_array($risultato))
{
$macIF1=$riga["macIF1"];
$macIF2=$riga["macIF2"];
$macIF3=$riga["macIF3"];
$macIFV=$riga["macIFV"];
$connIF1=$riga["connIF1"];
$connIF2=$riga["connIF2"];
$connIF3=$riga["connIF3"];
$connIFV=$riga["connIFV"];
$IP_IF1=$riga["IP_IF1"];
$IP_IF2=$riga["IP_IF2"];
$IP_IF3=$riga["IP_IF3"];
$IP_IFV=$riga["IP_IFV"];
$netmask_IF1=$riga["netmask_IF1"];
$netmask_IF2=$riga["netmask_IF2"];
$netmask_IF3=$riga["netmask_IF3"];
$netmask_IFV=$riga["netmask_IFV"];
$gatewayIF1=$riga["gatewayIF1"];
$gatewayIF2=$riga["gatewayIF2"];
$gatewayIF3=$riga["gatewayIF3"];
$gatewayIFV=$riga["gatewayIFV"];
$lanDMZIF1=$riga["lanDMZIF1"];
$lanDMZIF2=$riga["lanDMZIF2"];
$lanDMZIF3=$riga["lanDMZIF3"];
$lanDMZIFV=$riga["lanDMZIFV"];
$rackIF1=$riga["rackIF1"];
$rackIF2=$riga["rackIF2"];
$rackIF3=$riga["rackIF3"];
$rackIFV=$riga["rackIFV"];
$patchIF1=$riga["patchIF1"];
$patchIF2=$riga["patchIF2"];
$patchIF3=$riga["patchIF3"];
$patchIFV=$riga["patchIFV"];
$switchIF1=$riga["switchIF1"];
$switchIF2=$riga["switchIF2"];
$switchIF3=$riga["switchIF3"];
$switchIFV=$riga["switchIFV"];
$portaIF1=$riga["portaIF1"];
$portaIF2=$riga["portaIF2"];
$portaIF3=$riga["portaIF3"];
$portaIFV=$riga["portaIFV"];
$operatore_rete=$riga["operatore_rete"];
$data_rete=$riga["data_rete"];
$IDrete=$riga["IDrete"];
echo "
<tr><th colspan="6"> </th><th colspan="2" class="b">Eseguito</th>
<th class="larg"> </th></tr>
<tr><td colspan="2" class="bold">Interfacce di rete</td>
<td class="bold">IF 1 (WAN)</td>
<td class="bold">IF 2 (LAN)</td>
<td class="bold">IF 3</td>
<td class="bold">IF Virt.</td>
<td class="bold">Data</td>
<td class="bold">Operatore</td>
<td class="larg">ID</td></tr>
<tr>
<td colspan="2" class="bold">MAC Address</td>
<td> $macIF1</td>
<td> $macIF2</td>
<td> $macIF3</td>
<td> $macIFV</td>
<td rowspan="10"> $data_rete</td>
<td rowspan="10"> $operatore_rete</td>
<td rowspan="10" class="larg">$IDrete</td></tr>
<tr><td colspan="2" class="bold">Connettore (RJ45, MTRJ, SC)</td>
<td> $connIF1</td>
<td> $connIF2</td>
<td> $connIF3</td>
<td> $connIFV</td></tr>
<tr><td colspan="2" class="bold">IP Address</td>
<td> $IP_IF1</td>
<td> $IP_IF2</td>
<td> $IP_IF3</td>
<td> $IP_IFV</td></tr>
<tr><td colspan="2" class="bold">Netmask</td>
<td> $netmask_IF1</td>
<td> $netmask_IF2</td>
<td> $netmask_IF3</td>
<td> $netmask_IFV</td></tr>
<tr><td colspan="2" class="bold">Default Gateway</td>
<td> $gatewayIF1</td>
<td> $gatewayIF2</td>
<td> $gatewayIF3</td>
<td> $gatewayIFV</td></tr>
<tr><td rowspan="5" class="bold">Connesso a...</td>
<td class="bold">LAN/DMZ</td>
<td> $lanDMZIF1</td>
<td> $lanDMZIF2</td>
<td> $lanDMZIF3</td>
<td> $lanDMZIFV</td></tr>
<tr><td class="bold">Rack</td>
<td> $rackIF1</td>
<td> $rackIF2</td>
<td> $rackIF3</td>
<td> $rackIFV</td></tr>
<tr><td class="bold">Patch Panel</td>
<td> $patchIF1</td>
<td> $patchIF2</td>
<td> $patchIF3</td>
<td> $patchIFV</td></tr>
<tr><td class="bold">Switch</td>
<td> $switchIF1</td>
<td> $switchIF2</td>
<td> $switchIF3</td>
<td> $switchIFV</td></tr>
<tr><td class="bold">Porta</td>
<td> $portaIF1</td>
<td> $portaIF2</td>
<td> $portaIF3</td>
<td> $portaIFV</td></tr>";
}
echo "</tbody>";
echo "</table> <br /><br />";
//tab3
echo "<table border="1">
<tbody>";
echo "
<tr>
<th rowspan="2" class="bold">Descrizione software</th>
<th rowspan="2" class="bold">Versione</th>
<th colspan="2" class="b">Eseguito</th>
<th class="larg"> </th></tr>
<th class="bold">Data</th>
<th class="bold">Operatore</th>
<th class="larg">ID</th>
</tr>";
while ($riga = mysql_fetch_array($risultato))
{
$descrizione_sw=$riga["descrizione_sw"];
$versione=$riga["versione"];
$data=$riga["data"];
$operatore=$riga["operatore"];
$IDsw=$riga["IDsw"];
//$DATEhide=$riga["DATEhide"];
{
echo "
<tr>
<td> $descrizione_sw</td>
<td> $versione</td>
<td> $data</td>
<td> $operatore</td>
<td class="larg">$IDsw</td>
</tr>";
}
}
echo "</tbody>";
echo "</table> <br /><br />";
//tab4
echo "<table border="1">
<tbody>";
echo "
<tr>
<th rowspan="2" class="bold">Source host <br /> <br /> (PIX NAME)</th>
<th rowspan="2" class="bold">IP address</th>
<th rowspan="2" class="bold">Protocollo</th>
<th rowspan="2" class="bold">Porta</th>
<th colspan="2" class="b">Eseguito</th>
<th class="larg"> </th></tr>
<th class="bold">Data</th>
<th class="bold">Operatore</th>
<th class="larg">ID</th>
</tr>";
while ($riga = mysql_fetch_array($risultato))
{
$source_host=$riga["source_host"];
$IPaddress=$riga["IPaddress"];
$protocollo=$riga["protocollo"];
$porta=$riga["porta"];
$data=$riga["data"];
$operatore=$riga["operatore"];
$IDshost=$riga["IDshost"];
//$DATEhide=$riga["DATEhide"];
{
echo "
<tr>
<td> $source_host</td>
<td> $IPaddress</td>
<td> $protocollo</td>
<td> $porta</td>
<td> $data</td>
<td> $operatore</td>
<td class="larg">$IDshost</td>
</tr>";
}
}
echo "</tbody>";
echo "</table> <br /><br />";
//tab5
echo "<table border="1">
<tbody>";
echo "
<tr>
<th rowspan="2" class="bold">Destination <br /> <br /> (PIX NAME)</th>
<th rowspan="2" class="bold">IP address</th>
<th rowspan="2" class="bold">Protocollo</th>
<th rowspan="2" class="bold">Porta</th>
<th colspan="2" class="b">Eseguito</th>
<th class="larg"> </th></tr>
<th class="bold">Data</th>
<th class="bold">Operatore</th>
<th class="larg">ID</th>
</tr>";
while ($riga = mysql_fetch_array($risultato))
{
$destination_host=$riga["destination_host"];
$IPaddress=$riga["IPaddress"];
$protocollo=$riga["protocollo"];
$porta=$riga["porta"];
$data=$riga["data"];
$operatore=$riga["operatore"];
$IDDhost=$riga["IDDhost"];
//$DATEhide=$riga["DATEhide"];
{
echo"
<tr>
<td> $destination_host</td>
<td> $IPaddress</td>
<td> $protocollo</td>
<td> $porta</td>
<td> $data</td>
<td> $operatore</td>
<td class="larg">$IDDhost</td></tr>";
}
}
echo "</tbody>";
echo "</table>";
?>[/php]P.S. alcune tabelle hanno i nomi uguali per esempio data oppure operatore,_questi verranno modificati al più presto nel DB.