tags:

views:

37

answers:

1

here is my query

insert into invoices 
  set Invoice_number = '823N9823',
      price = '11,768.00',
      code = 'ret_4_business', 
      created_at = '2010-09-27';

but my price in my db is 11, not 11768

how do i handle money in mysql? the field is a decimal

CREATE TABLE `invoices` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`Invoice_number` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`price` decimal(10,0) DEFAULT NULL,
`code` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`created_at` datetime DEFAULT NULL,
`updated_at` datetime DEFAULT NULL,
 PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+3  A: 

Any non-number character will terminate the parsing and save only part of the number. Remove the comma characters from the query.

thevikas