Need to add default text value

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bulgin
Forum Commoner
Posts: 29
Joined: Wed Feb 11, 2009 8:47 pm

Need to add default text value

Post by bulgin »

Using phpMyAdmin - 2.11.8.1deb1 and Ver 14.12 Distrib 5.0.67, for debian-linux-gnu (i486) using readline 5.2, and I cannot create a text field that will have a default value of "Please contact the business office for further information at xxx-xxx-xxxx. Thank you." -- you get the idea.

How does one go about creating a text field in MySQL that will contain a default value every time a record is added?

Thanks!
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: Need to add default text value

Post by califdon »

bulgin wrote:Using phpMyAdmin - 2.11.8.1deb1 and Ver 14.12 Distrib 5.0.67, for debian-linux-gnu (i486) using readline 5.2, and I cannot create a text field that will have a default value of "Please contact the business office for further information at xxx-xxx-xxxx. Thank you." -- you get the idea.

How does one go about creating a text field in MySQL that will contain a default value every time a record is added?

Thanks!
If you're using phpMyAdmin, you should be able to enter a default value without any problem. What isn't working?

If you want to do it in SQL, that's pretty straightforward, too. Something like:

Code: Select all

...
   myText VarChar(255) Default "Please contact ..."
Describe what you've tried that doesn't work, and how it doesn't work.
bulgin
Forum Commoner
Posts: 29
Joined: Wed Feb 11, 2009 8:47 pm

Re: Need to add default text value

Post by bulgin »

working now -- I didn't put in the max characters allowed. I wouldn't have known about that unless you had shown me how to do it with sql.

All fixed.

thanks!
:wink:
Post Reply