Ciao a tutti!
Ho una pagina php che preleva dal db mysql dei dati e me li mette in una tabella.
Questo è il codice:
...
<?php
//include database connection
include 'libs/db_connect.php';
//select all data
$query = "SELECT id, marchiocommerciale, ragionesociale, sedelegale, indirizzo, cap, citta, prov, nazione, sedeoperativa,
referente, tel, fax, email, website, pec, codfisc, piva, note, data FROM anagrafica";
$stmt = $con->prepare( $query );
$stmt->execute();
//this is how to get number of rows returned
$num = $stmt->rowCount();
//check if more than 0 record found
if($num>0){
//start table
echo "<table border='1'>";
//creating our table heading
echo "<tr>";
echo "<th>marchiocommerciale</th>";
echo "<th>ragionesociale</th>";
echo "<th>sedelegale</th>";
echo "<th>indirizzo</th>";
echo "<th>cap</th>";
echo "<th>citta</th>";
echo "<th>prov</th>";
echo "<th>nazione</th>";
echo "<th>sedeoperativa</th>";
echo "<th>referente</th>";
echo "<th>tel</th>";
echo "<th>fax</th>";
echo "<th>email</th>";
echo "<th>website</th>";
echo "<th>pec</th>";
echo "<th>codfisc</th>";
echo "<th>piva</th>";
echo "<th>note</th>";
echo "<th>data</th>";
echo "</tr>";
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)){
//extract row
//this will make $row['firstname'] to
//just $firstname only
extract($row);
//creating new table row per record
echo "<tr>";
echo "<td>{$marchiocommerciale}</td>";
echo "<td>{$ragionesociale}</td>";
echo "<td>{$sedelegale}</td>";
echo "<td>{$indirizzo}</td>";
echo "<td>{$cap}</td>";
echo "<td>{$citta}</td>";
echo "<td>{$prov}</td>";
echo "<td>{$nazione}</td>";
echo "<td>{$sedeoperativa}</td>";
echo "<td>{$referente}</td>";
echo "<td>{$tel}</td>";
echo "<td>{$fax}</td>";
echo "<td>{$email}</td>";
echo "<td>{$website}</td>";
echo "<td>{$pec}</td>";
echo "<td>{$codfisc}</td>";
echo "<td>{$piva}</td>";
echo "<td>{$note}</td>";
echo "<td>{$data}</td>";
echo "<td>";
//we will use this links on next part of this post
echo "<a href='edit.php?id={$id}'>Edit</a>";
echo " / ";
//we will use this links on next part of this post
echo "<a href='#' onclick='delete_user( {$id} );'>Delete</a>";
echo "</td>";
echo "</tr>";
}
//end table
echo "</table>";
}
//if no records found
else{
echo "No records found.";
}
?>
...
Vorrei sapere se fosse possibile visualizzare/nascondere delle colonne in "Real Time". Riesco a farlo in php oppure dovrei implementare del codice css/jquery?
Grazie a chi mi risponderà!