2010-03-28 22:10:10 +00:00
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
2009-07-11 08:13:42 +00:00
|
|
|
<!-- $Revision$ -->
|
2007-06-20 22:25:43 +00:00
|
|
|
<refentry xml:id="function.mysql-select-db" xmlns="http://docbook.org/ns/docbook">
|
2005-03-30 04:07:29 +00:00
|
|
|
<refnamediv>
|
|
|
|
<refname>mysql_select_db</refname>
|
|
|
|
<refpurpose>Select a MySQL database</refpurpose>
|
|
|
|
</refnamediv>
|
2005-03-31 07:47:25 +00:00
|
|
|
|
2012-06-05 07:55:24 +00:00
|
|
|
<refsynopsisdiv role="soft-deprecation-notice">
|
|
|
|
<sidebar>
|
|
|
|
&mysql.alternative.note;
|
|
|
|
<simplelist role="alternatives">
|
|
|
|
<member><function>mysqli_select_db</function></member>
|
|
|
|
<member><methodname>PDO::__construct</methodname> (part of dsn)</member>
|
|
|
|
</simplelist>
|
|
|
|
</sidebar>
|
|
|
|
</refsynopsisdiv>
|
|
|
|
|
2005-03-31 07:47:25 +00:00
|
|
|
<refsect1 role="description">
|
|
|
|
&reftitle.description;
|
2005-03-30 06:27:14 +00:00
|
|
|
<methodsynopsis>
|
|
|
|
<type>bool</type><methodname>mysql_select_db</methodname>
|
|
|
|
<methodparam><type>string</type><parameter>database_name</parameter></methodparam>
|
2012-02-23 16:23:01 +00:00
|
|
|
<methodparam choice="opt"><type>resource</type><parameter>link_identifier</parameter><initializer>NULL</initializer></methodparam>
|
2005-03-30 06:27:14 +00:00
|
|
|
</methodsynopsis>
|
2005-03-30 04:07:29 +00:00
|
|
|
<para>
|
2005-03-31 07:47:25 +00:00
|
|
|
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.
|
2005-03-30 04:07:29 +00:00
|
|
|
</para>
|
2005-03-31 07:47:25 +00:00
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="parameters">
|
|
|
|
&reftitle.parameters;
|
2005-03-30 04:07:29 +00:00
|
|
|
<para>
|
2005-03-31 07:47:25 +00:00
|
|
|
<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>
|
2005-03-30 04:07:29 +00:00
|
|
|
</para>
|
2005-03-31 07:47:25 +00:00
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="returnvalues">
|
|
|
|
&reftitle.returnvalues;
|
2005-03-30 04:07:29 +00:00
|
|
|
<para>
|
2005-03-31 07:47:25 +00:00
|
|
|
&return.success;
|
2005-03-30 04:07:29 +00:00
|
|
|
</para>
|
2005-03-31 07:47:25 +00:00
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="examples">
|
|
|
|
&reftitle.examples;
|
2005-03-30 04:07:29 +00:00
|
|
|
<para>
|
|
|
|
<example>
|
|
|
|
<title><function>mysql_select_db</function> example</title>
|
|
|
|
<programlisting role="php">
|
2003-08-16 09:37:55 +00:00
|
|
|
<![CDATA[
|
|
|
|
<?php
|
|
|
|
|
2004-02-20 17:36:42 +00:00
|
|
|
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
|
|
|
|
if (!$link) {
|
|
|
|
die('Not connected : ' . mysql_error());
|
|
|
|
}
|
2003-08-16 09:37:55 +00:00
|
|
|
|
|
|
|
// make foo the current db
|
2004-02-20 17:36:42 +00:00
|
|
|
$db_selected = mysql_select_db('foo', $link);
|
|
|
|
if (!$db_selected) {
|
|
|
|
die ('Can\'t use foo : ' . mysql_error());
|
|
|
|
}
|
2003-08-16 09:37:55 +00:00
|
|
|
?>
|
|
|
|
]]>
|
2005-03-30 04:07:29 +00:00
|
|
|
</programlisting>
|
|
|
|
</example>
|
|
|
|
</para>
|
2005-03-31 07:47:25 +00:00
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="notes">
|
|
|
|
&reftitle.notes;
|
|
|
|
<note>
|
|
|
|
<para>
|
|
|
|
&info.deprecated.alias;
|
2007-10-12 10:03:53 +00:00
|
|
|
<function>mysql_selectdb</function>
|
2005-03-31 07:47:25 +00:00
|
|
|
</para>
|
|
|
|
</note>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="seealso">
|
|
|
|
&reftitle.seealso;
|
2005-03-30 04:07:29 +00:00
|
|
|
<para>
|
2005-03-31 07:47:25 +00:00
|
|
|
<simplelist>
|
|
|
|
<member><function>mysql_connect</function></member>
|
|
|
|
<member><function>mysql_pconnect</function></member>
|
|
|
|
<member><function>mysql_query</function></member>
|
|
|
|
</simplelist>
|
2005-03-30 04:07:29 +00:00
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
</refentry>
|
2002-04-15 00:12:54 +00:00
|
|
|
|
|
|
|
<!-- 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
|
2009-09-25 07:04:39 +00:00
|
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
2002-04-15 00:12:54 +00:00
|
|
|
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
|
|
|
|
-->
|