PHP 4.2.2 Float->Mysql addition problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi List ^_^

PHP 4.2.2
Redhat 7.3
Mysql 3.23.54

Ok here is the problem:
I try to summary float values from my database (mysql) in PHP.

code:

$sql = "SELECT * FROM somwehere WHERE 1";
$result = mysql_query($sql);
while ($assoc = mysql_fetch_assoc($result))
  {
    //adding values
    $sum = $sum + $assoc["floatval"];
  }
echo $sum; // echoes an INTEGER VALUE O_o

echoing the mysql value it is float like "123.45"

The type of the mysql value is "string"
setting the type to float doesnt help (settype())

Any ideas?

Greets
	Barry

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux