svn: /phpdoc/en/trunk/reference/mysqli/functions/ mysqli-connect.xml
| From: | Philip Olson | Date: | Thu, 03 Sep 2015 02:52:40 +0000 |
| Subject: | svn: /phpdoc/en/trunk/reference/mysqli/functions/ mysqli-connect.xml | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-13696@lists.php.net to get a copy of this message | ||
philip Thu, 03 Sep 2015 02:52:40 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=337725
Log:
Added a mysqli_connect() example, now all old user comments here can be deleted
Changed paths:
U phpdoc/en/trunk/reference/mysqli/functions/mysqli-connect.xml
Modified: phpdoc/en/trunk/reference/mysqli/functions/mysqli-connect.xml
===================================================================
--- phpdoc/en/trunk/reference/mysqli/functions/mysqli-connect.xml 2015-09-03 01:20:30 UTC (rev
337724)
+++ phpdoc/en/trunk/reference/mysqli/functions/mysqli-connect.xml 2015-09-03 02:52:40 UTC (rev
337725)
@@ -11,8 +11,45 @@
<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