title: How to insert DECIMAL into MySQL database
body: <p>I have a database table with some fields, one of them, <code>cost</code>, is set to the <code>DECIMAL</code> data type. I set the parameters to <code>4,2</code>, which should allow 4 numbers before the decimal point, and 2 afterwards.</p>
  
  <p>(I've been told that the <code>4</code> here is the total amount, and the <code>2</code> is the amount after the decimal, could somebody please clear that up on a side note?)</p>
  
  <p>When I insert data via a POST request (the value <code>3.80</code> for example) the data stored to my database is actually <code>99.99</code>.</p>
  
  <p>What am I doing wrong to cause this?</p>
  
  <p>Here's the table:</p>
  
  <pre><code>CREATE TABLE IF NOT EXISTS `mytable` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `title` varchar(256) NOT NULL,
  `cost` decimal(4,2) NOT NULL,
  PRIMARY KEY (`id`)
  )
  </code></pre>
  
  <p>Here's my add query:</p>
  
  <pre><code>INSERT INTO mytable (`id`,`title`,`cost`) 
  VALUES (0, 'test title', '3.80')
  </code></pre>
  
  <p>Update:
  <strong>It works after I changed 4,2 to 6,2</strong></p>