Re: [PHP] Field type for american money

2009-06-12 Thread Andrew Ballard
On Thu, Jun 11, 2009 at 4:08 PM, revDAVE wrote: > Php - MySQL - newbie question > > - Field type for american money - int(11) seems to work fine > > - but also I tried decimal(10,2) > > Is one a better choice than another for american money usage? > > > -- > Thanks - RevDave > Cool @ hosting4days .

Re: [PHP] Field type for american money

2009-06-11 Thread Shawn McKenzie
Robert Cummings wrote: > Shawn McKenzie wrote: >> Waynn Lue wrote: >>> For mysql, it's better to use int and then store it in cents (or >>> micros) so you can use all integer operations instead of float ones. >>> >> >> To each his own. Speed or otherwise I don't see a difference between: >> >> $to

Re: [PHP] Field type for american money

2009-06-11 Thread Waynn Lue
> > Shawn McKenzie wrote: > >> Waynn Lue wrote: >> >>> For mysql, it's better to use int and then store it in cents (or >>> micros) so you can use all integer operations instead of float ones. >>> >>> >> To each his own. Speed or otherwise I don't see a difference between: >> >> $total = 19.95 + 3

Re: [PHP] Field type for american money

2009-06-11 Thread Robert Cummings
Shawn McKenzie wrote: Waynn Lue wrote: For mysql, it's better to use int and then store it in cents (or micros) so you can use all integer operations instead of float ones. To each his own. Speed or otherwise I don't see a difference between: $total = 19.95 + 3.99; //shipping and $total =

Re: [PHP] Field type for american money

2009-06-11 Thread Shawn McKenzie
Waynn Lue wrote: > For mysql, it's better to use int and then store it in cents (or > micros) so you can use all integer operations instead of float ones. > To each his own. Speed or otherwise I don't see a difference between: $total = 19.95 + 3.99; //shipping and $total = 1995 + 399; //shipp

Re: [PHP] Field type for american money

2009-06-11 Thread Waynn Lue
For mysql, it's better to use int and then store it in cents (or micros) so you can use all integer operations instead of float ones. On 6/11/09, Shawn McKenzie wrote: > revDAVE wrote: >> Php - MySQL - newbie question >> >> - Field type for american money - int(11) seems to work fine >> >> - but

Re: [PHP] Field type for american money

2009-06-11 Thread Daniel Brown
On Thu, Jun 11, 2009 at 16:08, revDAVE wrote: > Php - MySQL - newbie question > > - Field type for american money - int(11) seems to work fine > > - but also I tried decimal(10,2) > > Is one a better choice than another for american money usage? For PHP, check out money_format(), number_format