Home >Backend Development >PHP Problem >How to create a data table using php

How to create a data table using php

藏色散人
藏色散人Original
2019-09-18 10:20:366568browse

How to create a data table using php

How to use php to create a data table

Open the php editor and write the comment content of this program .

How to create a data table using php

Then create a new function create_table

How to create a data table using php

Create a variable that needs to be connected to the database and assign it a value.

How to create a data table using php

Then connect to the database through mysqli.

How to create a data table using php

After the connection is completed, we start to write the sql statement to create the data table.

$sql="create table test1(
id int(7) unsigned not null auto_increment primary key,
username varchar(64) not null,
age int(3) not null,
register_time timestamp
)";

How to create a data table using php

Execute sql statement. $connect->query($sql)

How to create a data table using php

Call this function.

create_table();

How to create a data table using php

For more PHP knowledge, please visit PHP tutorial!

The above is the detailed content of How to create a data table using 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