Un saluto a tutto il forum,
avrei bisogno del vostro supporto per realizzare una tabella che inserisca il fatturato aziendale totale mensile anno per anno.
Ho creato con php questa tabella:
i dati sono memorizzati all'interno di un database mysql, naturalmente nel database ho un campo che si chiama: totale di tipo decimal(10,2) ma e memorizza il totale per ogni singolo lavoro eseguito.codice HTML:<!DOCTYPE html> <html lang="it"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous"> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script> <title>Document</title> </head> <body> <?php echo" <table class='table table-bordered table-striped'> <thead> <tr> <th scope='col'></th> <th class='text-center' scope='col'> Incasso<br> 2016 </th> <th class='text-center' scope='col'> Incasso<br> 2017 </th> <th class='text-center' scope='col'> Incasso<br> 2018 </th> <th class='text-center' scope='col'> Incasso<br> 2019 </th> <th class='text-center' scope='col'> Incasso<br> 2020 </th> </tr> </thead> <tbody> <tr> <th class='text-nowrap' scope='row'>Gennaio</th> <td>Qua deve valorizzare Gennaio 2016</td> </tr> <tr> <th class='text-nowrap' scope='row'>Febbraio</th> <td>Qua deve valorizzare Febbraio 2016</td> </tr> <tr> <th class='text-nowrap' scope='row'>Marzo</th> <td>Qua deve valorizzare Marzo 2016</td> </tr> <tr> <th class='text-nowrap' scope='row'>Aprile</th> <td>Qua deve valorizzare Aprile 2016</td> </tr> <tr> <th class='text-nowrap' scope='row'>Maggio</th> <td>Qua deve valorizzare Maggio 2016</td> </tr> <tr> <th class='text-nowrap' scope='row'>Giugno</th> <td>Qua deve valorizzare Giugno 2016</td> </tr> <tr> <th class='text-nowrap' scope='row'>Luglio</th> <td>Qua deve valorizzare Luglio 2016</td> </tr> <th class='text-nowrap' scope='row'>Agosto</th> <td>Qua deve valorizzare Agosto 2016</td> </tr> <th class='text-nowrap' scope='row'>Settembre</th> <td>Qua deve valorizzare Settembre 2016</td> </tr> <th class='text-nowrap' scope='row'>Ottobre</th> <td>Qua deve valorizzare Ottobre 2016</td> </tr> <th class='text-nowrap' scope='row'>Novembre</th> <td>Qua deve valorizzare Novembre 2016</td> </tr> <th class='text-nowrap' scope='row'>Dicembre</th> <td>Qua deve valorizzare Dicembre 2016</td> </tr> </tbody>"; echo"</table>"; ?> </body> </html>
In tutta sostanza dovrei scrivere una query che:
selezioni tutti i lavori eseguiti dal 01/01/2016 al 31/01/2016 e ne mostri il totale nella cella
e cosi per tutte le celle di tutti gli anni.codice HTML:<td>Qua deve valorizzare Gennaio 2016</td>
Mi dareste una mano a comprendere come gestire la situazione
Grazie anticipatamente
![]()