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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.