Dysan Posted November 15, 2007 Share Posted November 15, 2007 Hello! I have the following code that creates a table structure. How do I give Age a default value of 0 mysql_select_db("DB", $connection); $sql = "CREATE TABLE Person ( Name text, Age text, Sex text )"; Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted November 15, 2007 Share Posted November 15, 2007 You cannot set a default value to a TEXT type field. To do it to another type field though, you use the keyword DEFAULT. EX CREATE TABLE Person ( Name text, Age int(3) DEFAULT '0', Sex text ) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.