• Bannato User Attivo

    Spillare i risultati

    Ciao a tutti, ragazzi ho un problema..
    vorrei estrarre dei dati dal db per posizionarli nella tabella come li dico io ma la classe che ho scaricato per la paginazione di record non me lo permetto o per lo meno non capisco io come fare.

    <?php echo $grid->getRows();?>
    il codice sopra estrappola dal db i dati e li stampa per come sono. certo escono in colonna però io avrei bisogno di manipolarli.. come potrei fare?

    posto anche il codice completo.. Grazie a tutti ciao

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" >
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Example 1 PDatagrid</title>
    <link rel="stylesheet" type="text/css" href="style.css" />
    </head>
    <body>
    <?php
    require 'pdatagrid.class.php';

    //Establish a database connection
    require 'dbconfig.php';
    $conn = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD) or die('Connection to database failed: ' . mysql_error());
    mysql_select_db(DB_NAME) or die ('select_db failed!');

    //Initialize instance with database connection
    $grid = new PDatagrid($conn);

    //SQL queries to count/select records
    $grid->setSqlCount("Select count(*) from milano");
    $grid->setSqlSelect("SELECT comune, zona, tipologia, locali, mq, prezzo, giorno, mese, anno FROM milano WHERE provincia = 'MI' ORDER BY id DESC");

    //Base url for navigation links
    $grid->baselink = $_SERVER['PHP_SELF'];

    //Maximum number of page navigation links
    $grid->setMaxNavLinks(4);

    //Rows (records) per page
    $grid->setRowsPerPage(10);

    //Set current page index
    if(isset($_GET['page']))
    $grid->setPage($_GET['page']);
    ?>
    <table cellspacing="0" cellpadding="0" >
    <thead>
    <tr>
    <td >Comune </td>
    <td >Zona </td>
    <td >Tipollogia </td>
    <td >Locali </td>
    <td >Mq </td>
    <td >Prezzo</td>
    <td > </td>
    <td> </td>
    <td>Data </td>
    </tr>
    </thead>
    <tfoot>
    <tr>
    <td colspan="9">
    <span id="navlinks"><?php echo $grid->getLinks();?></span>
    </td>
    </tr>
    </tfoot>
    <tbody>
    <?php echo $grid->getRows();?>
    </tbody>
    </table>

    </body>
    </html>