I am trying to make a CO2 compensation calculation for one of my customers.
The user fills in some fields (gas , electricity) and this data is stored in a DB-table. I have given the fields data-type int(11), but also tried smallint.
With chronoconnectivity I try to do the calculation. Below is just a try:
Body Field:
Result:
compesnsation gas 111 ton CO2
added value gas: 0 m3
is not an integer
Value1 = just a value to try
$gas= '{gas}'; to retrieve the data from the DB
The calculation always the result 111 whatever value of gas is used. the field gas is not handled as a integer field. The is_int function proves that.
Any one an idea?
The user fills in some fields (gas , electricity) and this data is stored in a DB-table. I have given the fields data-type int(11), but also tried smallint.
With chronoconnectivity I try to do the calculation. Below is just a try:
Body Field:
<?php
$value1 = 111;
$gas= '{gas}';
$result = $value1 - $gas;
echo "compesnsation gas " .$result. " ton CO2 ";
echo "<br>\n";
echo "added value gas: " .$gas. " m3";
echo "<br>\n";
if (is_int($gas)) {
echo "is integer\n";
} else {
echo "is not an integer\n";
}
?>
Result:
compesnsation gas 111 ton CO2
added value gas: 0 m3
is not an integer
Value1 = just a value to try
$gas= '{gas}'; to retrieve the data from the DB
The calculation always the result 111 whatever value of gas is used. the field gas is not handled as a integer field. The is_int function proves that.
Any one an idea?