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 )"; Link to comment https://forums.phpfreaks.com/topic/77503-create-table-with-default-values/ 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 ) Link to comment https://forums.phpfreaks.com/topic/77503-create-table-with-default-values/#findComment-392315 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.