mysql_create_db
mysql_create_db
Create a MySQL database
Waarschuwing: >
mysqli_query``PDO::query
bool **mysql_create_db** string $database_name resource $link_identifier
attempts to create a new
database on the server associated with the specified link
identifier.
mysql_create_db
database_nameThe name of the database being created.
return.success
Voorbeeld: alternative example
The function is deprecated. It is
preferable to use to issue an sql
statement instead.
mysql_create_db``mysql_query``CREATE DATABASE
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
$sql = 'CREATE DATABASE my_db';
if (mysql_query($sql, $link)) {
echo "Database my_db created successfully\n";
} else {
echo 'Error creating database: ' . mysql_error() . "\n";
}
?>
Database my_db created successfully
Opmerking: > info.deprecated.alias
mysql_createdb
Opmerking: > This function will not be available if the MySQL extension was built against a MySQL 4.x client library.
mysql_query``mysql_select_db