questa è una prova, vedi se funziona a impostare SOLO la query per il momento. poi proseguiamo con l' impaginazione ad hoc senza utilizzare cose strane
Codice PHP:
<?php
<body>
<body link="#000082" vlink="#000042" alink="#000082" bgcolor="#FFFFFF">
<tr><font face="Rockwell" size="2" color="#FF0000">ELENCO DEI RISULTATI RICERCATI:</font></tr>
</p>
<?php
$max_res=25; // quanti risultati per ogni pagina?
//gestione errori
function mysql_die($error = "sconosciuto")
{
echo "<H1>Errore:". $error."</H1>";
exit;
}
//gestione connessione
require "ezine_db.inc.php";
$ezine_db = ezine_connecte_db();
$query_standard="SELECT id,data,comp,playa,teama,goala,vpna,playb,teamb,goalb,vpnb FROM partitelle";
if (isset($_GET['search'])) unset($_GET['search']);
if (isset($_GET['page'])) $now=($_GET['page']*$max_res)+1;
else $now=0;
$PARAMS_A=array();
$PARAMS_B=array();
$fields=array('datsei'=>'partitelle.iddate', //standard
'datsette'=>'partitelle.iddate', //standard
'datotto'=>'partitelle.iddate', //standard
'com'=>'partitelle.comp', //standard
'pla'=>'partitelle.play',
'tea'=>'partitelle.idteam',
'goa'=>'partitelle.goal',
'ris'=>'partitelle.vpn');
foreach ($_GET as $key=>$value)
{
if (!empty($_GET[$key]) && $_GET[$key] !="#")
{
if ($key !="datsei" && $key !="datsette" && $key !="datotto" && $key !="com")
{
$PARAMS_A[]=$fields[$key]."a='".$value."'";
$PARAMS_B[]=$fields[$key]."b='".$value."'";
}
else
{
$PARAMS_A[]=$fields[$key]."='".$value."'";
$PARAMS_B[]=$fields[$key]."='".$value."'";
}
}
}
if (!empty($PARAMS_A) && !empty($_PARAMS_B)) $end_query=$query_standard." WHERE (".implode(" AND ",$PARAMS_A).") OR (".implode(" AND ",$_PARAMS_B).") LIMIT $now,$max_res";
else $end_query=$query_standard." LIMIT $now,".$now+$max_res;
echo $end_query."
";
//impagino i risultati
require_once("php.sql.pager.class");
$_PAGER = new _makePager(25);
$stringa = mysql_query($ris);
$_PAGER = _getPagerData(mysql_result($stringa),$_GET[p]);
$_sql = mysql_query($stringa {$_PAGER->sql});
while ($row = mysql_fetch_row($_sql)) {
//stampo i risultati in una tabella
echo "
</p>";
echo "<table border=\"1\" cellspacing=\"0\" cellpadding=\"2\" style=\"border-left-style: solid; border-left-width: 1px; border-right-style: solid; border-right-width: 1px; border-top-style: solid; border-top-width: 1px;\" bordercolor=\"#999999\" id=\"table1\">";
echo "<tr>";
echo "<td align=\"center\" width=\"20\" height=\"20\"><font color=\"#000000\" size=\"-1\" face=\"Tunga\">" . $d . "</td>";
echo "<td align=\"center\" width=\"70\" height=\"20\"><font color=\"#000000\" size=\"-1\" face=\"Tunga\">" . $dt . "</td>";
echo "<td align=\"center\" width=\"140\" height=\"20\"><font color=\"#000000\" size=\"-1\" face=\"Tunga\">" . $co . "</td>";
echo "<td align=\"center\" width=\"100\" height=\"20\"><font color=\"#000000\" size=\"-1\" face=\"Tunga\">" . $pla . "</td>";
echo "<td align=\"center\" width=\"140\" height=\"20\"><font color=\"#000000\" size=\"-1\" face=\"Tunga\">" . $tea . "</td>";
echo "<td align=\"center\" width=\"20\" height=\"20\"><font color=\"#000000\" size=\"-1\" face=\"Tunga\">" . $goa . "</td>";
echo "<td align=\"center\" width=\"20\" height=\"20\"><font color=\"#000000\" size=\"-1\" face=\"Tunga\">" . $va . "</td>";
echo "<td align=\"center\" width=\"100\" height=\"20\"><font color=\"#000000\" size=\"-1\" face=\"Tunga\">" . $plb . "</td>";
echo "<td align=\"center\" width=\"140\" height=\"20\"><font color=\"#000000\" size=\"-1\" face=\"Tunga\">" . $teb . "</td>";
echo "<td align=\"center\" width=\"20\" height=\"20\"><font color=\"#000000\" size=\"-1\" face=\"Tunga\">" . $gob . "</td>";
echo "<td align=\"center\" width=\"20\" height=\"20\"><font color=\"#000000\" size=\"-1\" face=\"Tunga\">" . $vb . "</td>";
echo "</tr>";
}
?>
</body>
?>