mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-21 11:28:55 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@337725 c90b9560-bf6c-de11-be94-00142212c4b1
75 lines
2 KiB
XML
75 lines
2 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<refentry xml:id="function.mysqli-connect" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>mysqli_connect</refname>
|
|
<refpurpose>&Alias; <methodname>mysqli::__construct</methodname></refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<para>
|
|
&info.function.alias; <methodname>mysqli::__construct</methodname>
|
|
</para>
|
|
<para>
|
|
Although the <methodname>mysqli::__construct</methodname> documentation also includes
|
|
procedural examples that use the <function>mysqli_connect</function> function, here
|
|
is a short example:
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<example>
|
|
<title><function>mysqli_connect</function> example</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$link = mysqli_connect("127.0.0.1", "my_user", "my_password", "my_db");
|
|
|
|
if (!$link) {
|
|
echo "Error: Unable to connect to MySQL." . PHP_EOL;
|
|
echo "Debugging errno: " . mysqli_connect_errno() . PHP_EOL;
|
|
echo "Debugging error: " . mysqli_connect_error() . PHP_EOL;
|
|
exit;
|
|
}
|
|
|
|
echo "Success: A proper connection to MySQL was made! The my_db database is great." . PHP_EOL;
|
|
echo "Host information: " . mysqli_get_host_info($link) . PHP_EOL;
|
|
|
|
mysqli_close($link);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&examples.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
Success: A proper connection to MySQL was made! The my_db database is great.
|
|
Host information: localhost via TCP/IP
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</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
|
|
-->
|
|
|