Home > Article > Backend Development > How to add fields in php
php method to add fields: first open the corresponding PHP file; then add fields through the "mysql_query("ALTER TABLE `article` ADD `keywords` varchar(100) NOT NULL default "")" method.
Recommended: "PHP Video Tutorial"
PHP operation MySQL adds a column (one field) to the table
For an already established database, the following methods can be used to add new fields to a table that already has fields:
mysql_query(“ALTER TABLE `表名` ADD `字段` 字段类型”) or die(mysql_error());
For example, add the field keywords to the table article
Another: Use the keyword AFTER to add a new field after the current specific field (that is, insert a column between two columns)
The above is the detailed content of How to add fields in php. For more information, please follow other related articles on the PHP Chinese website!