mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-23 20:38:56 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@128539 c90b9560-bf6c-de11-be94-00142212c4b1
78 lines
3.5 KiB
XML
78 lines
3.5 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.3 $ -->
|
|
<refentry id="function.mysqli-connect">
|
|
<refnamediv>
|
|
<refname>mysqli_connect</refname>
|
|
<refpurpose>Open a new connection to the MySQL server</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>resource</type><methodname>mysqli_connect</methodname>
|
|
<methodparam choice='opt'><type>string</type><parameter>hostname</parameter></methodparam>
|
|
<methodparam choice='opt'><type>string</type><parameter>username</parameter></methodparam>
|
|
<methodparam choice='opt'><type>string</type><parameter>passwd</parameter></methodparam>
|
|
<methodparam choice='opt'><type>string</type><parameter>dbname</parameter></methodparam>
|
|
<methodparam choice='opt'><type>int</type><parameter>port</parameter></methodparam>
|
|
<methodparam choice='opt'><type>string</type><parameter>socket</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
The <function>mysqli_connect</function> function attempts to open a connection to the MySQL Server
|
|
running on <parameter>host</parameter> which can be either a hostname or an IP address. Passing the
|
|
&null; value or the string "localhost" to this parameter, the local host is assumed. When possible,
|
|
pipes will be used instead of the TCP/IP protocol. If successful, the <function>mysqli_connect</function>
|
|
will return a resource representing the connection to the database, or &false; on failure.
|
|
</para>
|
|
<para>
|
|
The <parameter>username</parameter> and <parameter>password</parameter> parameters specify the
|
|
username and password under which to connect to the MySQL server. If the password is not provided
|
|
(the &null; value is passed), the MySQL server will attempt to authenticate the user against those
|
|
user records which have no password only. This allows one username to be used with different
|
|
permissions (depending on if a password as provided or not).
|
|
</para>
|
|
<para>
|
|
The <parameter>dbname</parameter> parameter if provided will specify the default database to be
|
|
used when performing queries.
|
|
</para>
|
|
<para>
|
|
The <parameter>port</parameter> and <parameter>socket</parameter> parameters are used in
|
|
conjunction with the <parameter>hostname</parameter> parameter to further control how to connect
|
|
to the database server. The <parameter>port</parameter> parameter specifies the port number to
|
|
attempt to connect to the MySQL server on, while the <parameter>socket</parameter> parameter
|
|
specifies the socket or named pipe that should be used.
|
|
</para>
|
|
<note>
|
|
<para>
|
|
Specifying the <parameter>socket</parameter> parameter will not explicitly determine the type
|
|
of connection to be used when connecting to the MySQL server. How the connection is made to the
|
|
MySQL database is determined by the <parameter>host</parameter> parameter.
|
|
</para>
|
|
</note>
|
|
<para>
|
|
See also
|
|
<function>mysqli_close</function> and
|
|
<function>mysqli_real_connect</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
|
|
-->
|