Jump to content

problem with numbers in an array


stacie1

Recommended Posts

Hi all :)

 

i have a script that get the numbers from a SQL table, rounds them and puts them into an array but the numbers dont come out right and i dont know why

 

php code

$wallet = array();

$sql="SELECT balance FROM wallet";
$result = mysql_query($sql) or die('Query failed: ' . mysql_error());	
if($result)
{
while($row = mysql_fetch_assoc($result))
{	
	$balance = round($row["balance"]);
	$wallet[] = $balance; 
}
}

 

the numbers look like this in the SQL table

3350000000.00
3400000000.00
3440000000.00
3445000000.00
3445000000.00
3449000000.00
3449500000.00
3450000000.00

but  come out like this in the array

Array ( [0] => 3350000000 [1] => 3.4E+9 [2] => 3.44E+9 [3] => 3.445E+9 [4] => 3.445E+9 [5] => 3.449E+9 [6] => 3449500000 [7] => 3450000000)

 

could someone tell me why this is and how to fix this please? (really new to php by the way)

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/95114-problem-with-numbers-in-an-array/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.