mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
fixed bugs in mysql_connect_err*
added sample for mysqli_connect git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@151911 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
fa2668bbe6
commit
52e87979a0
3 changed files with 47 additions and 46 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<!-- $Revision: 1.3 $ -->
|
||||
<refentry id="function.mysqli-connect-errno">
|
||||
<refnamediv>
|
||||
<refname>mysqli_connect_errno</refname>
|
||||
|
@ -32,6 +32,16 @@
|
|||
zero means no error occurred.
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1>
|
||||
<title>See also</title>
|
||||
<para>
|
||||
<function>mysqli_connect</function>,
|
||||
<function>mysqli_connect_error</function>,
|
||||
<function>mysqli_errno</function>,
|
||||
<function>mysqli_error</function>,
|
||||
<function>mysqli_sqlstate</function>
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<para>
|
||||
|
@ -52,16 +62,6 @@ if (!$link) {
|
|||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1>
|
||||
<title>See also</title>
|
||||
<para>
|
||||
<function>mysqli_connect</function>,
|
||||
<function>mysqli_connect_error</function>,
|
||||
<function>mysqli_errno</function>,
|
||||
<function>mysqli_error</function>,
|
||||
<function>mysqli_sqlstate</function>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<!-- $Revision: 1.3 $ -->
|
||||
<refentry id="function.mysqli-connect-error">
|
||||
<refnamediv>
|
||||
<refname>mysqli_connect_error</refname>
|
||||
|
@ -26,6 +26,16 @@
|
|||
A string that describes the error. An empty string if no error occurred.
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1>
|
||||
<title>See also</title>
|
||||
<para>
|
||||
<function>mysqli_connect</function>,
|
||||
<function>mysqli_connect_errno</function>,
|
||||
<function>mysqli_errno</function>,
|
||||
<function>mysqli_error</function>,
|
||||
<function>mysqli_sqlstate</function>
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<para>
|
||||
|
@ -46,16 +56,6 @@ if (!$link) {
|
|||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1>
|
||||
<title>See also</title>
|
||||
<para>
|
||||
<function>mysqli_connect</function>,
|
||||
<function>mysqli_connect_errno</function>,
|
||||
<function>mysqli_errno</function>,
|
||||
<function>mysqli_error</function>,
|
||||
<function>mysqli_sqlstate</function>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<!-- $Revision: 1.10 $ -->
|
||||
<refentry id="function.mysqli-connect">
|
||||
<refnamediv>
|
||||
<refname>mysqli_connect</refname>
|
||||
|
@ -75,38 +75,39 @@
|
|||
<title>Example</title>
|
||||
<para>
|
||||
<example>
|
||||
<title>Using the mysqli_connect function</title>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
/*
|
||||
+-----------------------------------------------------------+
|
||||
| file: mysqli_connect.php |
|
||||
+-----------------------------------------------------------+
|
||||
| connects to MySQL server on localhost and prints host |
|
||||
| information |
|
||||
+-----------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* ---- Procedural style ---- */
|
||||
$link = mysqli_connect("localhost", "my_user", "my_password", "test")
|
||||
or die("Can't connect to MySQL server on localhost");
|
||||
$mysqli = new mysqli("localhost", "my_user", "my_password", "test");
|
||||
|
||||
printf("Host information: %s\n", mysqli_get_host_info($link));
|
||||
if (mysqli_connect_errno()) {
|
||||
printf("Connect failed: %s\n", mysqli_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
mysqli_close($link);
|
||||
printf("Host information: %s\n", $mysqli->host_info);
|
||||
|
||||
/* ---- Object oriented style ----*/
|
||||
$mysqli = new mysqli("localhost", "my_user", "my_password", "test");
|
||||
/* close connection */
|
||||
$mysqli->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
/*
|
||||
$link = mysqli_connect("localhost", "my_user", "my_password", "test")
|
||||
or die("Can't connect to MySQL server on localhost");
|
||||
|
||||
if (mysqli_connect_errno()) {
|
||||
printf("Connect failed: %s\n", mysqli_connect_error());
|
||||
exit();
|
||||
}
|
||||
printf("Host information: %s\n", mysqli_get_host_info($link));
|
||||
|
||||
printf("Host information: %s\n", $mysqli->host_info);
|
||||
|
||||
$mysqli->close();
|
||||
/* close connection */
|
||||
mysqli_close($link);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
|
|
Loading…
Reference in a new issue