views:

45

answers:

3

I need to store user's signature (ie the thing at the bottom of a forum post) and am not sure how to, I could use text to store the html, but I think there are probably better solutions.

+1  A: 

A text field is OK for that. You could use a big varchar field also. But you will have to check and inform your user that there is a limit on the size of his/her signature (which is fine).

Pablo Santa Cruz
Does it need a specific length? If I leave it blank will it default to unlimited?
Ell
`varchar` does need length.
Pablo Santa Cruz
+2  A: 

I see no sense in this question. What's so special with this particular field?
Is it the only one field in this database?
if no - why it's only one raised such a question?

Why not to determine first, what field length will suit you, and then choose appropriate field type according to documentation?

Col. Shrapnel
Well I'm a complete MySQL noob and I wasn't sure if it was appropriate to store a signature in the actual database or if I should contain a url to link to a html file, I just thought that storing large chunks of data in the database may have bad side effects.
Ell
@Ell so you gonna say that it's the first piece of data you are going to store? Not forum posts or threads are your concern but just a "signature"?
Col. Shrapnel
very good point, I was realy just forward thinking, but after a little thought, seeing as though I'm a complete noob in php and MySQl, maybe a forum is a little ambitious. I will probably use phpbb anyway, but thanks for the input! :)
Ell
A: 

A text field is probably the best. If you are worried about the "structure" of the signature, you may use the nl2br() function in PHP, which will convert any new line character stored in the field into the HTML <br/>.

sorro
I'd say that text field is way too much for a signature and varchar(255) would be enough
Col. Shrapnel
There are plenty of forums where signature can be longer than 255 characters, though. It all depends on what s/he wants to do with the signature field...
sorro