Jump to content

Which types?


dmccabe

Recommended Posts

Text: *TEXT (there are a couple different variations of the TEXT type)

 

Sorry I should be asking all the questions at once instead of just as they come.

 

but what do you mean there are a couple of variations of text ? and which one should I be using ?  is "*TEXT" an actual type?

 

**EDIT** IGNORE - I see them now TEXT/MEDIUMTEXT/LONGTEXT  I have chose long text.

Link to comment
https://forums.phpfreaks.com/topic/98331-which-types/#findComment-503195
Share on other sites

I should probably point out however that if you want a BIT to come out as an numeric representation you'll need to do the following:

SELECT `bitfield`+0 FROM ...

 

You need to +0 to the field that contains the bit to get the numeric representation out of it.

 

note: this is as of 5.0.3

Link to comment
https://forums.phpfreaks.com/topic/98331-which-types/#findComment-503217
Share on other sites

Thanks guys!

 

 

One last question, when inputting a monetry amount would you use the type of "DECIMAL" ?

I use DOUBLE.

DOUBLE is terrible for monetary values -- floating-point error hell.

 

Check the mysql documentation for the size limitations of the different TEXT types. I have never needed anything more than TEXT. Also, regarding a yes|no option, you can always use BIT(1) ;)

In v5+, VARCHAR can be up to 65K -- much, much better than TEXT for about 15 different reasons.

 

And as for yes/no, I question your db design.

Link to comment
https://forums.phpfreaks.com/topic/98331-which-types/#findComment-503625
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.