2003-03-15 23:01:35 +00:00
|
|
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
2003-05-25 19:27:11 +00:00
|
|
|
<!-- $Revision: 1.6 $ -->
|
2003-03-15 23:01:35 +00:00
|
|
|
<refentry id="function.mysqli-change-user">
|
|
|
|
<refnamediv>
|
|
|
|
<refname>mysqli_change_user</refname>
|
2003-05-13 23:12:16 +00:00
|
|
|
<refpurpose>Changes the user of the specified database connection</refpurpose>
|
2003-03-15 23:01:35 +00:00
|
|
|
</refnamediv>
|
|
|
|
<refsect1>
|
|
|
|
<title>Description</title>
|
|
|
|
<methodsynopsis>
|
|
|
|
<type>bool</type><methodname>mysqli_change_user</methodname>
|
|
|
|
<methodparam><type>resource</type><parameter>link</parameter></methodparam>
|
|
|
|
<methodparam><type>string</type><parameter>user</parameter></methodparam>
|
|
|
|
<methodparam><type>string</type><parameter>password</parameter></methodparam>
|
|
|
|
<methodparam><type>string</type><parameter>database</parameter></methodparam>
|
|
|
|
</methodsynopsis>
|
|
|
|
<para>
|
2003-05-25 19:09:28 +00:00
|
|
|
<function>mysqli_change_user</function> is used to change the user of the specified
|
|
|
|
database connection as given by the <parameter>link</parameter> parameter and to set the
|
|
|
|
current database to that specified by the <parameter>database</parameter> parameter.
|
2003-03-15 23:01:35 +00:00
|
|
|
</para>
|
2003-05-13 23:12:16 +00:00
|
|
|
<para>
|
2003-05-25 19:09:28 +00:00
|
|
|
&return.success;
|
2003-05-23 18:07:24 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
2003-05-25 19:09:28 +00:00
|
|
|
If desired, the &null; value may be passed in place of the <parameter>database</parameter>
|
|
|
|
parameter resulting in only changing the user and not selecting a database. To select
|
|
|
|
a database in this case use the <function>mysqli_select_db</function> function.
|
2003-05-13 23:12:16 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
2003-05-25 19:09:28 +00:00
|
|
|
In order to successfully change users a valid <parameter>username</parameter> and
|
|
|
|
<parameter>password</parameter> parameters must be provided and that user must have
|
|
|
|
sufficient permissions to access the desired database. If for any reason authorization
|
|
|
|
fails, the current user authentication will remain.
|
2003-05-13 23:12:16 +00:00
|
|
|
</para>
|
|
|
|
<note>
|
|
|
|
<para>
|
2003-05-25 19:09:28 +00:00
|
|
|
Using this command will always cause the current database connection to behave as if
|
|
|
|
was a completely new database connection, regardless of if the operation was completed
|
|
|
|
successfully. This reset includes performing a rollback on any active transactions,
|
|
|
|
closing all temporary tables, and unlocking all locked tables.
|
2003-05-13 23:12:16 +00:00
|
|
|
</para>
|
|
|
|
</note>
|
2003-05-25 18:02:46 +00:00
|
|
|
<para>
|
2003-05-25 19:09:28 +00:00
|
|
|
<example>
|
2003-05-25 19:27:11 +00:00
|
|
|
<title>Using the mysqli_change_user function</title>
|
|
|
|
<programlisting role="php">
|
2003-05-25 18:02:46 +00:00
|
|
|
<![CDATA[
|
|
|
|
<?php
|
|
|
|
|
|
|
|
/* Open a connection as foo@localhost and select foo_db */
|
|
|
|
$link = mysqli_connect("localhost", "foo", "pass");
|
|
|
|
mysqli_select_db("foo_db");
|
|
|
|
|
|
|
|
/* Change user to bar@localhost and default database to bar_db */
|
|
|
|
mysqli_change_user($link, "bar", "otherpass", "bar_db");
|
|
|
|
|
|
|
|
?>
|
|
|
|
]]>
|
2003-05-25 19:27:11 +00:00
|
|
|
</programlisting>
|
2003-05-25 19:09:28 +00:00
|
|
|
</example>
|
2003-05-25 18:02:46 +00:00
|
|
|
</para>
|
2003-03-15 23:01:35 +00:00
|
|
|
</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
|
|
|
|
-->
|