
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
Which PHP function is used to create a new database?
PHP uses mysql_query function to create a MySQL database. This function takes two parameters and returns TRUE on success or FALSE on failure. Its syntax is as follows −
Syntax
bool mysql_query( sql, connection );
Example
Followings are the parameters used in this function −
S. No. | Parameter & Description |
---|---|
Sql | Required - SQL query to create a MySQL database |
connection | Optional - if not specified, then the last opened connection by mysql_connect will be used. |
- Related Articles
- Which PHP function is used to select a MySQL database?
- Which PHP function is used to delete an existing database?
- Which PHP function is used to create a MySQL table?
- Which PHP function is used to establish MySQL database connection using PHP script?
- Which PHP function is used to disconnect from MySQL database connection?
- How can we create a new database by using PHP script?
- How to create a new database in MongoDB?
- Which PHP function is used to delete an existing MySQL table?
- Create a new database with MySQL Workbench?
- How to create a new image from a JPEG file using the imagecreatefromjpeg() function in PHP?
- Which PHP function is used to insert data into an existing MySQL table?
- Which PHP function is used to release cursor memory associated with MySQL result?
- How to create a new image from a WBMP file or URL using imagecreatefromwbmp() function in PHP?
- How to create a new image from a WEBP file or URL using imagecreatefromwebp() function in PHP?
- How to create a new image from a PNG file or URL using the imagecreatefrompng() function in PHP?

Advertisements