title: How to insert float variable in database properly
body: <p>I have the following table</p>
  
  <pre><code>CREATE TABLE IF NOT EXISTS `payment_data` (
    `orderid` int(11) NOT NULL,
    `orderDesc` varchar(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
    `name` varchar(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
    `email` varchar(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
    `orderAmount` float NOT NULL,
    UNIQUE KEY `orderid` (`orderid`)
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  </code></pre>
  
  <p>and I'm trying to insert a line in it using PHP. </p>
  
  <pre><code>$sql = 'INSERT INTO payment_data '.
             '(orderid, orderDesc, name, email, orderAmount) '.
             'VALUES ( '.$form_order_id.', "'.$form_order_desc.'", "'.$form_name.'", "'.$form_email.'", '.number_format($form_order_amount, 2, '.', ',').' )';
  </code></pre>
  
  <p>The problem is that "orderAmount" is inserted without the decimal part. For example if $form_order_amount=30,45 then 30 is what's inserted in database.</p>
  
  <p>I used number_format() because it's supposed to convert "30,45" to "30.45".</p>