I have a very simple SQL statement which performs "select avg(tinput) from data"
Here is my test code:
print $current["tinput"];
print settype($current["tinput"],"integer");
print gettype($current["tinput"]);
print ($current["tinput"] + 0);
The output is:
11586000000
1
integer
2147483647
So the first number is the correct sum, the second is sucessful conversion to an int, the third shows it is now an integer, and the last line is the first number + 0; Well that is definatly not the correct value.
I have used ($variable + 0) in the past to force a variable as an INT, but it doesn't work in this case. I even tried using (avg(tinput)/1000) and I get the same result.
Any help would be dandy!
thanks,
Matt
Here is my test code:
print $current["tinput"];
print settype($current["tinput"],"integer");
print gettype($current["tinput"]);
print ($current["tinput"] + 0);
The output is:
11586000000
1
integer
2147483647
So the first number is the correct sum, the second is sucessful conversion to an int, the third shows it is now an integer, and the last line is the first number + 0; Well that is definatly not the correct value.
I have used ($variable + 0) in the past to force a variable as an INT, but it doesn't work in this case. I even tried using (avg(tinput)/1000) and I get the same result.
Any help would be dandy!
thanks,
Matt