Home  >  Article  >  Backend Development  >  How to create a database using php

How to create a database using php

藏色散人
藏色散人Original
2019-09-18 10:15:445137browse

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 knowledge, please visit PHP Tutorial!

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