0

i have a simple division

$order = 14 / 10;   // 1
$order = 15 / 10;   // 2

result automatically convert into round figure

how can i get result like

$order = 14 / 10;   // 1.4
$order = 15 / 10;   // 1.5

here my actual code $quantity

if (($quantity > 0.99) && ($pro_Type== "BHRF")) {

    $pro_Id   = $pro_Id -10;
    $quantity = $quantity/10;

    for ($i=1; $i <11; $i++) { 

       $pro_Id = $pro_Id +10;

      $insert0 = mysql_query("INSERT INTO myorders1 (Product_Id,Quantity,Product_Type,Store_Id,Order_Date,Order_Time) 
                    VALUES ('$pro_Id','$quantity','$pro_Type','$store_Id','$o_Date','$o_Time')", $connection);
                }
            }
Rakesh
  • 181
  • 15

1 Answers1

0

Unless i'm drunk; 14/10 can't be 1 without any rounding involved

echo  14 / 10;    // 1.4 as expected

Most probably your database field, Quantity, is integer and doesnt store the fraction and you assume the real number came from division.

Fiddle

Hanky Panky
  • 46,730
  • 8
  • 72
  • 95