Home >Backend Development >PHP Problem >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.
Create a new function named create_data
Set the variables for user name, password and host name, and give They assign value.
$Username="root"; $Password=""; $servernmae="localhost";
Connect to the database.
After connecting to the database, start writing the sql statement to create the database.
Execute sql statement.
Just call this function.
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!