title: Handle decimal numbers in mysqli
body: <p>I have to put the price of some items inside a mysql table. When creating the table I'm using <code>DECIMAL(10,2)</code> as I don't need more than 2 digits after the comma (for example: 123,45 would be accepted as an input but 123,456 would be rounded to 123,45 with PHP).</p>
  
  <p>First question: using <code>DECIMAL(10,2)</code>, how do I know how many numbers may be stored before the comma? I know it is not 10, as 10 is just the precision Mysql uses when doing math with those numbers: so where the length of the number itself is specified?</p>
  
  <p>Second question: I'm using PHP to round user input to fit the data type (float with 2 numbers after the comma). How should I use <code>mysqli-&gt;bind_param</code> to insert those data? Which of these datatypes (from the <a href="http://php.net/manual/en/mysqli-stmt.bind-param.php">documentation</a>) accepted by <code>bind_param</code> should I use (and possibly: why)?</p>
  
  <pre><code>Character   Description
  i   corresponding variable has type integer
  d   corresponding variable has type double
  s   corresponding variable has type string
  b   corresponding variable is a blob and will be sent in packets
  </code></pre>