PHP Manual
Prev |  | Next

# mysql_create_db

mysql_create_db -- Create a MySQL database

## Description

`int mysql_create_db`(string database name, int [link_identifier] );

mysql_create_db() attempts to create a new database on the server associated with the specified link identifier.

Example 1. MySQL create database example
      1
      2 <?php
      3     $link = mysql_pconnect ("kron", "jutta", "geheim") {
      4         or die ("Could not connect");
      5     }
      6     if (mysql_create_db ("my_db")) {
      7         print ("Database created successfully\n");
      8     } else {
      9         printf ("Error creating database: %s\n", mysql_error ());
     10     }
     11 ?>
     12

For downwards compatibility mysql_createdb() can also be used.

See also: mysql_drop_db().

Prev | Home | Next
mysql_connect | Up | mysql_data_seek