Hi
I am new in this forum, but I hope its ok ask for a little help.
I have installed a virtual server and NetBeans and taught myself some php and mysql and have successfully created some programs to give me an overview of our daily finances.
I have processed the bank statements and created some database files. BUT - now I’ve gotten to the point where I want to show it all on the screen, but have run into a problem I can’t figure out.
I have made a small simple code snippet which shows the problem. Hope it makes sense.
<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<title>Vis sumtotaler i kolonner pr. md.</title>
<link rel="stylesheet" href="Stylesheet_hjemmeside.css" type="text/css"/>
</head>
<body>
<?php
$sti2 ="totale_saldi_1.csv";
$csv = array(13);
$handle1 = fopen($sti2, "r") or die("can't open file");
while (($info = fgetcsv($handle1, 120, ";")) !==false)
{
if (empty($info[0]))
{
goto stop;
}
if (empty($info[1]))
{
$info[1] = 0;
}
if (empty($info[2]))
{
$info[2] = 0;
}
if (empty($info[3]))
{
$info[3] = 0;
}
if (empty($info[4]))
{
$info[4] = 0;
}
if (empty($info[5]))
{
$info[5] = 0;
}
if (empty($info[6]))
{
$info[6] = 0;
}
if (empty($info[7]))
{
$info[7] = 0;
}
if (empty($info[8]))
{
$info[8] = 0;
}
if (empty($info[9]))
{
$info[9] = 0;
}
if (empty($info[10]))
{
$info[10] = 0;
}
if (empty($info[11]))
{
$info[11] = 0;
}
if (empty($info[12]))
{
$info[12] = 0;
}
echo "<table style=\"border-style: solid;border-width: thin;border-collapse: collapse;\">";
echo "<tr><td style=\"text-align:center;padding-center:5px;border-style: solid;border-width: thin;border-collapse: collapse;background-color:lightgrey;color:black; width:100px;font-size: 12px\">";
echo $info[0];
echo "</td><td style=\"text-align:right;padding-right:5px;border-style: solid;border-width: thin;border-collapse: collapse;background-color:#AFEEEE ; color:black; width:80px;font-size: 12px\">";
echo $info[1];
echo "</td><td style=\"text-align:right;padding-right:5px;border-style: solid;border-width: thin;border-collapse: collapse;background-color:#AFEEEE ; color:black; width:80px;font-size: 12px\">";
echo$info[2];
echo "</td><td style=\"text-align:right;padding-right:5px;border-style: solid;border-width: thin;border-collapse: collapse;background-color:#AFEEEE ; color:black; width:80px;font-size: 12px\">";
echo $info[3];
echo "</td><td style=\"text-align:right;padding-right:5px;border-style: solid;border-width: thin;border-collapse: collapse;background-color:#AFEEEE ; color:black; width:80px;font-size: 12px\">";
echo $info[4];
echo "</td><td style=\"text-align:right;padding-right:5px;border-style: solid;border-width: thin;border-collapse: collapse;background-color:#AFEEEE ; color:black; width:80px;font-size: 12px\">";
echo $info[5];
echo "</td><td style=\"text-align:right;padding-right:5px;border-style: solid;border-width: thin;border-collapse: collapse;background-color:#AFEEEE ; color:black; width:80px;font-size: 12px\">";
echo$info[6];
echo "</td><td style=\"text-align:right;padding-right:5px;border-style: solid;border-width: thin;border-collapse: collapse;background-color:#AFEEEE ; color:black; width:80px;font-size: 12px\">";
echo $info[7];
echo "</td><td style=\"text-align:right;padding-right:5px;border-style: solid;border-width: thin;border-collapse: collapse;background-color:#AFEEEE ; color:black; width:80px;font-size: 12px\">";
echo $info[8];
echo "</td><td style=\"text-align:right;padding-right:5px;border-style: solid;border-width: thin;border-collapse: collapse;background-color:#AFEEEE ; color:black; width:80px;font-size: 12px\">";
echo $info[9];
echo "</td><td style=\"text-align:right;padding-right:5px;border-style: solid;border-width: thin;border-collapse: collapse;background-color:#AFEEEE ; color:black; width:80px;font-size: 12px\">";
echo $info[10];
echo "</td><td style=\"text-align:right;padding-right:5px;border-style: solid;border-width: thin;border-collapse: collapse;background-color:#AFEEEE ; color:black; width:80px;font-size: 12px\">";
echo $info[11];
echo "</td><td style=\"text-align:right;padding-right:5px;border-style: solid;border-width: thin;border-collapse: collapse;background-color:#AFEEEE ; color:black; width:80px;font-size: 12px\">";
echo $info[12];
echo "</td><td style=\"text-align:right;padding-right:5px;border-style: solid;border-width: thin;border-collapse: collapse;background-color:#AFEEEE ; color:black; width:80px;font-size: 12px\">";
echo "</td></tr>";
echo "</table>";
stop:
}
The data in this code snippet comes from a .csv file:
Month;1;2;3;4;5;6;7;8;9;10;11;12
Special income; 4100.00;4100.00;4100.00;4100.00;4100.00;4100.00;4100.00;4100.00;4100.00; 4100.00;4100.00;4100.00;
Normal income - salary; 20627.00;20627.00;20627.00;20627.00;20627.00;20627.00;20627.00; 20627.00;20627.00;20627.00;20627.00;20627.00;
Rent,electricity and water;-13000.00;-13000.00;-13000.00;-13000.00;-13000.00; -13000.00; -13000.00;-13000.00;-13000.00;-13000.00;-13000.00;-13000.00;
The output on screen looks like this:
Month 1 2 3 4 5 6
Special income 4100.00 4100.00 4100.00 4100.00 4100.00 4100.00
7 8 9 10 11 12
4100.00 4100.00 4100.00 4100.00 4100.00 4100.00
1 2 3 4 5 6
Normal income - salary 20627.00 20627.00 20627.00 20627.00 20627.00 20627.00
7 8 9 10 11 12
20627.00 20627.00 20627.00 20627.00 20627.0 0
1 2 3 4 5 6
Rent,electricity and water -13000.00 -13000.00 -13000.00 -13000.00 -13000.00 -13000.00
7 8 9 10 11 12
-13000.00 -13000.00 -13000.00 -13 0 0
As you see in the .csv file - all 3 data lines contains 12 times an amount.
The first one with a small monthly amount shows 12 times 4100.00
The sesond line with a large amount shows 10 times 20627.00 and one time 20627.0 (one decimal) and one time zero
The third line with a negativ amount shows 9 times -13000.00, one time -13 and 2 times zero
eg har testet, at hvis jeg reducerer teksten, bliver der plads til flere cifre.
Det ser ud som om der er en begrænsning et eller andet sted.
Er der nogen der har har en ide om, hvad der er galt ???
thanks in advance
Freddy