php-doc-en/reference/mysql/functions/mysql-create-db.xml
2002-04-21 13:03:37 +00:00

80 lines
2.3 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.3 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 -->
<refentry id="function.mysql-create-db">
<refnamediv>
<refname>mysql_create_db</refname>
<refpurpose>Create a MySQL database</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>mysql_create_db</methodname>
<methodparam><type>string</type><parameter>database name</parameter></methodparam>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_create_db</function> attempts to create a new
database on the server associated with the specified link
identifier.
</para>
<para>
&return.success;
</para>
<example>
<title>MySQL create database example</title>
<programlisting role="php">
<![CDATA[
<?php
$link = mysql_pconnect("localhost", "mysql_user", "mysql_password")
or exit("Could not connect");
if (mysql_create_db("my_db")) {
print ("Database created successfully\n");
} else {
printf ("Error creating database: %s\n", mysql_error ());
}
?>
]]>
</programlisting>
</example>
<para>
For downwards compatibility <function>mysql_createdb</function>
can also be used. This is deprecated, however.
</para>
<note>
<para>
The function <function>mysql_create_db</function> is deprecated. It
is preferable to use <function>mysql_query</function> to issue a
SQL CREATE DATABASE Statement instead.
</para>
</note>
<para>
See also: <function>mysql_drop_db</function>,
<function>mysql_query</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->