Home  >  Article  >  php教程  >  thinkphp create new data table

thinkphp create new data table

WBOY
WBOYOriginal
2016-09-29 09:18:541705browse

Because tp does not have a function to create a new table, I believe that many people use tp to create a new table in native form, but there will be a problem (error report) in native form. However, if an error is reported, the new table will be created successfully... There is a function to create a new table below. Everyone
$sql = << CREATE TABLE `system_novel_one` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` char(200) DEFAULT NULL COMMENT 'Chapter name',
`contents` text COMMENT 'Chapter text',
`next` int(11) DEFAULT NULL COMMENT 'Next chapter address',
`pid` int(11) DEFAULT NULL COMMENT 'Novel name',
`novel_url` char(50) DEFAULT NULL COMMENT 'Novel chapter address',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;
sql;

dump(M()->execute($sql));

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