php-doc-en/reference/mysql/functions/mysql-select-db.xml
Adam Harvey 65e697ff67 Officially deprecate ext/mysql in the manual.
Specific changes:

- Upgraded the soft deprecation sidebars to full blown warnings.
- Beefed up the wording of the soft deprecation notice boilerplate.
- Added changelog items for mysql_connect() and mysql_pconnect(), since they're
  the functions that have changed behaviour.
- Updated the MySQL changelog.
- Updated the 5.5 migration guide.


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@328734 c90b9560-bf6c-de11-be94-00142212c4b1
2012-12-10 15:22:07 +00:00

124 lines
3 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.mysql-select-db" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>mysql_select_db</refname>
<refpurpose>Select a MySQL database</refpurpose>
</refnamediv>
<refsynopsisdiv>
<warning>
&mysql.alternative.note;
<simplelist role="alternatives">
<member><function>mysqli_select_db</function></member>
<member><methodname>PDO::__construct</methodname> (part of dsn)</member>
</simplelist>
</warning>
</refsynopsisdiv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>mysql_select_db</methodname>
<methodparam><type>string</type><parameter>database_name</parameter></methodparam>
<methodparam choice="opt"><type>resource</type><parameter>link_identifier</parameter><initializer>NULL</initializer></methodparam>
</methodsynopsis>
<para>
Sets the current active database on the server that's associated with the
specified link identifier. Every subsequent call to
<function>mysql_query</function> will be made on the active database.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>database_name</parameter></term>
<listitem>
<para>
The name of the database that is to be selected.
</para>
</listitem>
</varlistentry>
&mysql.linkid.description;
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>mysql_select_db</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
die('Not connected : ' . mysql_error());
}
// make foo the current db
$db_selected = mysql_select_db('foo', $link);
if (!$db_selected) {
die ('Can\'t use foo : ' . mysql_error());
}
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
<note>
<para>
&info.deprecated.alias;
<function>mysql_selectdb</function>
</para>
</note>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>mysql_connect</function></member>
<member><function>mysql_pconnect</function></member>
<member><function>mysql_query</function></member>
</simplelist>
</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:"~/.phpdoc/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
-->