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

How to create a database using php

藏色散人
藏色散人Original
2019-10-19 17:19:096003browse

How to create a database using php

How to create a database using php?

First open our php editor and write comments in the newly created file.

How to create a database using php

Create a new function named create_data

How to create a database using php

Set the variables for user name, password and host name, and give They assign value.

$Username="root";
$Password="";
$servernmae="localhost";

How to create a database using php

Connect to the database.

How to create a database using php

After connecting to the database, start writing the sql statement to create the database.

How to create a database using php

Execute sql statement.

How to create a database using php

Just call this function.

How to create a database using php

For more PHP related knowledge, please visit PHP Chinese website!

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