Ho visto le demo e sarebbe fantastico se riuscissi a mettere nella mia tabella la paginazione e il search...ho provato a seguire gli esempi ma non è molto chiaro tanto che non mi funziona...ti posto il mio codice php così magari vedi cosa non va:
Non ti soffermare troppo sulle query che sono un pò contorte e se non ci sei dentro è difficile capirle!!!Codice PHP:<html>
<head><title>Campioni accettati e non presi in carico della tua sede di appartenenza</title>
<style type="text/css" title="currentStyle">
@import "C:/Apache/thdocs/DataTables-1.8.1/media/css/demo_page.css";
@import "C:/Apache/thdocs/DataTables-1.8.1/media/css/demo_table.css";
</style>
<script type="text/javascript" src="C:/Apache/thdocs/DataTables-1.8.1/media/js/jquery.dataTables.js"></script>
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$('#example').dataTable( {
"sPaginationType": "full_numbers"
} );
} );
</script>
</head>
<body>
<?php
session_start();
$utente=$_SESSION['utente'];
$_SESSION['pass'];
$cod_utente=$_SESSION['cod_utente'];
$sede_utente=$_SESSION['sede_utente'];
$_SESSION['macro'];
$con=oci_connect("xxx", "xxx", "xxx");
$query=oci_parse($con,"select u.cod_utente, us.cod_sede
from con_utenti u, con_utenti_sedi us
where u.cod_utente=us.cod_utente and u.nome_utente='$utente'");
oci_execute($query);
while (($row=oci_fetch_array($query, OCI_NUM + OCI_RETURN_NULLS))){
$cod_utente=$row[0];
$sede_utente=$row[1];
}
//parte di codice relativo alla paginazione che avevo fatto precedentemente
la lascio perchè tanto non da fastidio e mi serve sulla query successiva
$webpage = basename($_SERVER['PHP_SELF']);
$page = (!isset($_GET['page']))? 1 : $_GET['page'];
$queryprima=oci_parse($con,"select count(*) from cons_esami_assegnare where sede='$sede_utente'");
oci_execute($queryprima);
while (($ris=oci_fetch_array($queryprima, OCI_ASSOC))){
foreach ($ris as $pippo){
}
}
$max_results = 10;//numero di elementi da visualizzare per pagina.
$total_results = $pippo;
$total_pages = ceil($total_results / $max_results);
$from = (($page * $max_results) - $max_results);
$a= ($max_results * $page);
//query per estrapolare la data più vecchia
$querydata=oci_parse($con, "select min(to_date(dataaccettazione,'dd-mm-yyyy')) from cons_esami_assegnare where sede='$sede_utente'");
oci_execute($querydata);
while (($row=oci_fetch_array($querydata, OCI_NUM + OCI_RETURN_NULLS))){
$datavecchia=$row[0];
}
$giorno = date("d");
$mese = date("n");
$anno = date("y");
$nomemese = array (1 => "GEN", "FEB", "MAR", "APR", "MAG", "GIU", "LUG", "AGO", "SET", "OTT", "NOV", "DIC");
//query prima tabella con paginazione
$query_tab1=oci_parse($con, "select r, c1, c2, c3, c4, c5, c6, c7
from (select rownum r, richiesta c1, to_date(dataaccettazione, 'dd-mm-yyyy') c2, quesito c3, laboratorio c4, campioni c5, giornipassatiaccettazione c6, ordinelab c7
from cons_esami_assegnare where sede='$sede_utente' and rownum <= $a)
where r > $from");
echo('<div id="demo">');
echo("<table border='1' align='center' id='example'>");
echo("<thead>
<tr><th align='center'>Richiesta</th>
<th align='center'>Data accettazione</th>
<th align='center'>Quesito</th>
<th align='center'>Laboratorio</th>
<th align='center'>Numero di campioni</th>
<th align='center'>Giorni passati dalla data di accettazione</th>
<th align='center'>Ordine laboratorio</th>
</tr></thead><tbody>");
oci_execute($query_tab1);
while (($riga=oci_fetch_array($query_tab1, OCI_NUM + OCI_RETURN_NULLS))){
echo ("<tr><td align='center'>".$riga[1]."</td><td align='center'>".$riga[2]."</td><td align='center'>".$riga[3]."
</td><td align='center'>".$riga[4]."</td><td align='center'>".$riga[5]."</td><td align='center'>".$riga[6]."
</td><td align='center'>".$riga[7]."</td></tr>");
}
echo("</tbody></table>");
echo("</div>");
oci_close($con);
?>
</body>
</html>
Cmq se riesci a darmi una mano te ne sarei davvero grata.
Perchè la soluzione che mi hai proposto DataTables è formidabile soltanto che devo capire come funziona ma una volta fatta una cosa dovrebbe essere facile metterci tutto il resto!!!
Grazie mille
Sara

Rispondi quotando
