Jump to content

Not recognizing commas in numbers?


ERuiz

Recommended Posts

I have the following problem:

[code]
$sqlfield13 = "SELECT field13 FROM vb3_userfield WHERE userid = '".$IDPilot."' ";
$Resultfield13  = $MyDb->f_ExecuteSql($sqlfield13);
$PrevHours = $MyDb->f_GetRecord($Resultfield13);
$PrevHours = $PrevHours['field13'];
$PrevHours = number_format($PrevHours);

if ($PrevHours >= 100) {

$PrevHours = 50;

}
else {

$PrevHours = 0;

}
[/code]

In the case above, I get the following results:

if field13 = 234.3 then $PrevHours = 50
if field13 = 72.3 then $PrevHours = 0
if field13 = 1,023.3 then $PrevHours = 0

How come the last situation is giving the wrong result?

Regards,

ERuiz
Link to comment
https://forums.phpfreaks.com/topic/33558-not-recognizing-commas-in-numbers/
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.