php-doc-en/reference/mysqli/functions/mysqli-error.xml

83 lines
2.6 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.8 $ -->
<refentry id="function.mysqli-error">
<refnamediv>
<refname>mysqli_error</refname>
<refpurpose>Returns a string description of the last error</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<para>Procedural style:</para>
<methodsynopsis>
<type>string</type><methodname>mysqli_error</methodname>
<methodparam><type>object</type><parameter>link</parameter></methodparam>
</methodsynopsis>
<para>Object oriented style (property)</para>
<classsynopsis>
<ooclass><classname>mysqli</classname></ooclass>
<fieldsynopsis><type>string</type><varname>error</varname></fieldsynopsis>
</classsynopsis>
<para>
The <function>mysqli_error</function> function is identical to the corresponding
<function>mysqli_errno</function> function in every way, except instead of returning
an integer error code the <function>mysqli_error</function> function will return
a string representation of the last error to occur for the database connection
represented by the <parameter>link</parameter> parameter. If no error has occured,
this function will return an empty string.
</para>
</refsect1>
<refsect1>
<title>Return values</title>
<para>
A string that describes the error. An empty string if no error occurred.
</para>
</refsect1>
<refsect1>
<title>Example</title>
<para>
<example>
<title>Using the mysqli_error function</title>
<programlisting role="php">
<![CDATA[
<?php
/* Fail to open a connection */
$host = "no_such_host";
$link = mysqli_connect($host, "username", "password") or
die("Couldn't connect : " . mysqli_error());
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1>
<title>See also</title>
<para>
<function>mysqli_errno</function>, <function>mysqli_sqlstate</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
-->