Verschil als uitkomst?
Nu wil ik dus als einde beide van elkaar aftrekken om het verschil te zien, echter dit lukt me niet.
Zie code.:
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$sql1 = "SELECT SUM(`Bedrag_Debet`) AS Bedrag_Debet_Total FROM `Huishouden`";
$result1 = mysqli_query($conn, $sql1);
$row1 = mysqli_fetch_object($result1) ;
echo "Totaal Debet: " . $row1->Bedrag_Debet_Total;
echo "<br>" ;
$sql2 = "SELECT SUM(`Bedrag_Credit`) AS Bedrag_Credit_Total FROM `Huishouden`";
$result2 = mysqli_query($conn, $sql2);
$row2 = mysqli_fetch_object($result2) ;
$testje1 = $row1->Bedrag_Debet_Total;
$testje2 = $row2->Bedrag_Credit_Total;
echo "Totaal Credit: " . $row2->Bedrag_Credit_Total;
echo "<br>" ;
echo "Verschil Debet/Credit: " . ??;
$result1 = mysqli_query($conn, $sql1);
$row1 = mysqli_fetch_object($result1) ;
echo "Totaal Debet: " . $row1->Bedrag_Debet_Total;
echo "<br>" ;
$sql2 = "SELECT SUM(`Bedrag_Credit`) AS Bedrag_Credit_Total FROM `Huishouden`";
$result2 = mysqli_query($conn, $sql2);
$row2 = mysqli_fetch_object($result2) ;
$testje1 = $row1->Bedrag_Debet_Total;
$testje2 = $row2->Bedrag_Credit_Total;
echo "Totaal Credit: " . $row2->Bedrag_Credit_Total;
echo "<br>" ;
echo "Verschil Debet/Credit: " . ??;
Kan iemand me helpen hoe ik bij verschil debet/credit, dit nu kan doen?
Alvast bedankt.
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php
$sql = "SELECT SUM(`Bedrag_Debet`) AS Bedrag_Debet_Total,
SUM(`Bedrag_Credit`) AS Bedrag_Credit_Total,
(SUM(`Bedrag_Debet`) - SUM(`Bedrag_Credit`)) AS Bedrag_Verschil
FROM `Huishouden`";
$result = mysqli_query($conn, $sql);
$row = mysqli_fetch_object($result);
echo "Totaal Debet: " . $row->Bedrag_Debet_Total;
echo "<br>" ;
echo "Totaal Credit: " . $row->Bedrag_Credit_Total;
echo "<br>" ;
echo "Verschil Debet/Credit: " . $row->Bedrag_Verschil;
?>
$sql = "SELECT SUM(`Bedrag_Debet`) AS Bedrag_Debet_Total,
SUM(`Bedrag_Credit`) AS Bedrag_Credit_Total,
(SUM(`Bedrag_Debet`) - SUM(`Bedrag_Credit`)) AS Bedrag_Verschil
FROM `Huishouden`";
$result = mysqli_query($conn, $sql);
$row = mysqli_fetch_object($result);
echo "Totaal Debet: " . $row->Bedrag_Debet_Total;
echo "<br>" ;
echo "Totaal Credit: " . $row->Bedrag_Credit_Total;
echo "<br>" ;
echo "Verschil Debet/Credit: " . $row->Bedrag_Verschil;
?>
- SanThe - op 04/04/2020 19:37:07:
Kan dat niet gewoon zo?
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php
$sql = "SELECT SUM(`Bedrag_Debet`) AS Bedrag_Debet_Total,
SUM(`Bedrag_Credit`) AS Bedrag_Credit_Total,
(SUM(`Bedrag_Debet`) - SUM(`Bedrag_Credit`)) AS Bedrag_Verschil
FROM `Huishouden`";
$result = mysqli_query($conn, $sql);
$row = mysqli_fetch_object($result);
echo "Totaal Debet: " . $row->Bedrag_Debet_Total;
echo "<br>" ;
echo "Totaal Credit: " . $row->Bedrag_Credit_Total;
echo "<br>" ;
echo "Verschil Debet/Credit: " . $row->Bedrag_Verschil;
?>
$sql = "SELECT SUM(`Bedrag_Debet`) AS Bedrag_Debet_Total,
SUM(`Bedrag_Credit`) AS Bedrag_Credit_Total,
(SUM(`Bedrag_Debet`) - SUM(`Bedrag_Credit`)) AS Bedrag_Verschil
FROM `Huishouden`";
$result = mysqli_query($conn, $sql);
$row = mysqli_fetch_object($result);
echo "Totaal Debet: " . $row->Bedrag_Debet_Total;
echo "<br>" ;
echo "Totaal Credit: " . $row->Bedrag_Credit_Total;
echo "<br>" ;
echo "Verschil Debet/Credit: " . $row->Bedrag_Verschil;
?>
TOP!!!! het werkt thx man.