Home  >  Article  >  Backend Development  >  How to add fields in php

How to add fields in php

藏色散人
藏色散人Original
2020-08-31 10:56:552631browse

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.

How to add fields in php

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn