Created
September 13, 2017 07:58
-
-
Save KlausAndersen1/b5c99981f52d9e4d8cbb2408be7ac3b5 to your computer and use it in GitHub Desktop.
PHP code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
///JAN | |
$query = "SELECT SUM(net_amount) FROM fin_costs WHERE month='1' AND group_of_cost='general' AND year_analysis='2017'"; | |
$result = mysqli_query($mysqli,$query); | |
while($row = mysqli_fetch_array($result)) | |
{$costs_general_jan = $row['SUM(net_amount)']; } | |
$query_update="UPDATE fin_analysis_2017 SET jan='$costs_general_jan' WHERE year_for_analysis='2017' AND id='1000' OR id='16000' "; | |
$result = mysqli_query($mysqli,$query_update); | |
///FEBR | |
$query = "SELECT SUM(net_amount) FROM fin_costs WHERE month='2' AND group_of_cost='general' AND year_analysis='2017'"; | |
$result = mysqli_query($mysqli,$query); | |
while($row = mysqli_fetch_array($result)) | |
{$costs_general_feb = $row['SUM(net_amount)']; } | |
$query_update="UPDATE fin_analysis_2017 SET feb='$costs_general_feb' WHERE year_for_analysis='2017' AND id='1000' OR id='16000' "; | |
$result = mysqli_query($mysqli,$query_update); | |
///MAR | |
$query = "SELECT SUM(net_amount) FROM fin_costs WHERE month='3' AND group_of_cost='general' AND year_analysis='2017'"; | |
$result = mysqli_query($mysqli,$query); | |
while($row = mysqli_fetch_array($result)) | |
{$costs_general_mar = $row['SUM(net_amount)']; } | |
$query_update="UPDATE fin_analysis_2017 SET mar='$costs_general_mar' WHERE year_for_analysis='2017' AND id='1000' OR id='16000' "; | |
$result = mysqli_query($mysqli,$query_update); | |
///APR | |
$query = "SELECT SUM(net_amount) FROM fin_costs WHERE month='4' AND group_of_cost='general' AND year_analysis='2017'"; | |
$result = mysqli_query($mysqli,$query); | |
while($row = mysqli_fetch_array($result)) | |
{$costs_general_apr = $row['SUM(net_amount)']; } | |
$query_update="UPDATE fin_analysis_2017 SET apr='$costs_general_apr' WHERE year_for_analysis='2017' AND id='1000' OR id='16000' "; | |
$result = mysqli_query($mysqli,$query_update); | |
///MAY | |
$query = "SELECT SUM(net_amount) FROM fin_costs WHERE month='5' AND group_of_cost='general' AND year_analysis='2017'"; | |
$result = mysqli_query($mysqli,$query); | |
while($row = mysqli_fetch_array($result)) | |
{$costs_general_may = $row['SUM(net_amount)']; } | |
$query_update="UPDATE fin_analysis_2017 SET may='$costs_general_may' WHERE year_for_analysis='2017' AND id='1000' OR id='16000' "; | |
$result = mysqli_query($mysqli,$query_update); | |
///JUN | |
$query = "SELECT SUM(net_amount) FROM fin_costs WHERE month='6' AND group_of_cost='general' AND year_analysis='2017'"; | |
$result = mysqli_query($mysqli,$query); | |
while($row = mysqli_fetch_array($result)) | |
{$costs_general_jun = $row['SUM(net_amount)']; } | |
$query_update="UPDATE fin_analysis_2017 SET jun='$costs_general_jun' WHERE year_for_analysis='2017' AND id='1000' OR id='16000' "; | |
$result = mysqli_query($mysqli,$query_update); | |
///JUL | |
$query = "SELECT SUM(net_amount) FROM fin_costs WHERE month='7' AND group_of_cost='general' AND year_analysis='2017'"; | |
$result = mysqli_query($mysqli,$query); | |
while($row = mysqli_fetch_array($result)) | |
{$costs_general_jul = $row['SUM(net_amount)']; } | |
$query_update="UPDATE fin_analysis_2017 SET jul='$costs_general_jul' WHERE year_for_analysis='2017' AND id='1000' OR id='16000' "; | |
$result = mysqli_query($mysqli,$query_update); | |
///AUG | |
$query = "SELECT SUM(net_amount) FROM fin_costs WHERE month='8' AND group_of_cost='general' AND year_analysis='2017'"; | |
$result = mysqli_query($mysqli,$query); | |
while($row = mysqli_fetch_array($result)) | |
{$costs_general_aug = $row['SUM(net_amount)']; } | |
$query_update="UPDATE fin_analysis_2017 SET aug='$costs_general_aug' WHERE year_for_analysis='2017' AND id='1000' OR id='16000' "; | |
$result = mysqli_query($mysqli,$query_update); | |
///SEP | |
$query = "SELECT SUM(net_amount) FROM fin_costs WHERE month='9' AND group_of_cost='general' AND year_analysis='2017'"; | |
$result = mysqli_query($mysqli,$query); | |
while($row = mysqli_fetch_array($result)) | |
{$costs_general_sep = $row['SUM(net_amount)']; } | |
$query_update="UPDATE fin_analysis_2017 SET sep='$costs_general_sep' WHERE year_for_analysis='2017' AND id='1000' OR id='16000' "; | |
$result = mysqli_query($mysqli,$query_update); | |
///OCT | |
$query = "SELECT SUM(net_amount) FROM fin_costs WHERE month='10' AND group_of_cost='general' AND year_analysis='2017'"; | |
$result = mysqli_query($mysqli,$query); | |
while($row = mysqli_fetch_array($result)) | |
{$costs_general_oct = $row['SUM(net_amount)']; } | |
$query_update="UPDATE fin_analysis_2017 SET oct='$costs_general_oct' WHERE year_for_analysis='2017' AND id='1000' OR id='16000' "; | |
$result = mysqli_query($mysqli,$query_update); | |
///NOV | |
$query = "SELECT SUM(net_amount) FROM fin_costs WHERE month='11' AND group_of_cost='general' AND year_analysis='2017'"; | |
$result = mysqli_query($mysqli,$query); | |
while($row = mysqli_fetch_array($result)) | |
{$costs_general_nov = $row['SUM(net_amount)']; } | |
$query_update="UPDATE fin_analysis_2017 SET nov='$costs_general_nov' WHERE year_for_analysis='2017' AND id='1000' OR id='16000' "; | |
$result = mysqli_query($mysqli,$query_update); | |
///DEC | |
$query = "SELECT SUM(net_amount) FROM fin_costs WHERE month='12' AND group_of_cost='general' AND year_analysis='2017'"; | |
$result = mysqli_query($mysqli,$query); | |
while($row = mysqli_fetch_array($result)) | |
{$costs_general_dece = $row['SUM(net_amount)']; } | |
$query_update="UPDATE fin_analysis_2017 SET dece='$costs_general_dece' WHERE year_for_analysis='2017' AND id='1000' OR id='16000' "; | |
$result = mysqli_query($mysqli,$query_update); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment