2003-03-15 23:01:35 +00:00
|
|
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
2004-11-12 14:01:04 +00:00
|
|
|
<!-- $Revision: 1.14 $ -->
|
2003-03-15 23:01:35 +00:00
|
|
|
<refentry id="function.mysqli-error">
|
|
|
|
<refnamediv>
|
|
|
|
<refname>mysqli_error</refname>
|
2004-03-16 15:36:17 +00:00
|
|
|
<refpurpose>Returns a string description of the last error</refpurpose>
|
2003-03-15 23:01:35 +00:00
|
|
|
</refnamediv>
|
|
|
|
<refsect1>
|
2004-03-16 15:36:17 +00:00
|
|
|
<title>Description</title>
|
|
|
|
<para>Procedural style:</para>
|
2003-03-15 23:01:35 +00:00
|
|
|
<methodsynopsis>
|
2004-03-16 15:36:17 +00:00
|
|
|
<type>string</type><methodname>mysqli_error</methodname>
|
2004-11-12 14:01:04 +00:00
|
|
|
<methodparam><type>mysqli</type><parameter>link</parameter></methodparam>
|
2003-03-15 23:01:35 +00:00
|
|
|
</methodsynopsis>
|
2004-03-16 15:36:17 +00:00
|
|
|
<para>Object oriented style (property)</para>
|
2004-01-28 23:18:42 +00:00
|
|
|
<classsynopsis>
|
|
|
|
<ooclass><classname>mysqli</classname></ooclass>
|
2004-03-16 15:36:17 +00:00
|
|
|
<fieldsynopsis><type>string</type><varname>error</varname></fieldsynopsis>
|
2004-01-28 23:18:42 +00:00
|
|
|
</classsynopsis>
|
2003-03-15 23:01:35 +00:00
|
|
|
<para>
|
2004-03-16 15:36:17 +00:00
|
|
|
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.
|
2003-03-15 23:01:35 +00:00
|
|
|
</para>
|
2004-01-28 23:18:42 +00:00
|
|
|
</refsect1>
|
|
|
|
<refsect1>
|
2004-10-31 16:05:14 +00:00
|
|
|
&reftitle.returnvalues;
|
2004-01-28 23:18:42 +00:00
|
|
|
<para>
|
2004-03-16 15:36:17 +00:00
|
|
|
A string that describes the error. An empty string if no error occurred.
|
2004-01-28 23:18:42 +00:00
|
|
|
</para>
|
|
|
|
</refsect1>
|
2004-02-20 14:45:50 +00:00
|
|
|
<refsect1>
|
2004-10-31 16:05:14 +00:00
|
|
|
&reftitle.seealso;
|
2004-02-20 14:45:50 +00:00
|
|
|
<para>
|
|
|
|
<function>mysqli_connect_errno</function>,
|
|
|
|
<function>mysqli_connect_error</function>,
|
2004-10-31 16:05:14 +00:00
|
|
|
<function>mysqli_errno</function>&listendand;
|
|
|
|
<function>mysqli_sqlstate</function>.
|
2004-02-20 14:45:50 +00:00
|
|
|
</para>
|
|
|
|
</refsect1>
|
2004-01-28 23:18:42 +00:00
|
|
|
<refsect1>
|
2004-10-31 16:05:14 +00:00
|
|
|
&reftitle.examples;
|
2004-02-25 21:59:16 +00:00
|
|
|
<example>
|
2004-03-16 15:36:17 +00:00
|
|
|
<title>Object oriented style</title>
|
2004-02-25 21:59:16 +00:00
|
|
|
<programlisting role="php">
|
2003-05-25 18:02:46 +00:00
|
|
|
<![CDATA[
|
|
|
|
<?php
|
2004-02-25 21:59:16 +00:00
|
|
|
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
|
|
|
|
|
|
|
|
/* check connection */
|
|
|
|
if (mysqli_connect_errno()) {
|
|
|
|
printf("Connect failed: %s\n", mysqli_connect_error());
|
|
|
|
exit();
|
|
|
|
}
|
2004-02-20 14:45:50 +00:00
|
|
|
|
|
|
|
if (!$mysqli->query("SET a=1")) {
|
2004-02-25 21:59:16 +00:00
|
|
|
printf("Errormessage: %s\n", $mysqli->error);
|
2004-02-20 14:45:50 +00:00
|
|
|
}
|
2004-02-25 21:59:16 +00:00
|
|
|
|
|
|
|
/* close connection */
|
2004-02-20 14:45:50 +00:00
|
|
|
$mysqli->close();
|
|
|
|
?>
|
|
|
|
]]>
|
2004-02-25 21:59:16 +00:00
|
|
|
</programlisting>
|
|
|
|
</example>
|
|
|
|
<example>
|
2004-03-16 15:36:17 +00:00
|
|
|
<title>Procedural style</title>
|
2004-02-25 21:59:16 +00:00
|
|
|
<programlisting role="php">
|
2004-02-20 14:45:50 +00:00
|
|
|
<![CDATA[
|
|
|
|
<?php
|
2004-02-25 21:59:16 +00:00
|
|
|
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
|
|
|
|
|
|
|
|
/* check connection */
|
|
|
|
if (mysqli_connect_errno()) {
|
|
|
|
printf("Connect failed: %s\n", mysqli_connect_error());
|
|
|
|
exit();
|
|
|
|
}
|
2004-02-20 14:45:50 +00:00
|
|
|
|
|
|
|
if (!mysqli_query($link, "SET a=1")) {
|
2004-02-25 21:59:16 +00:00
|
|
|
printf("Errormessage: %s\n", mysqli_error($link));
|
2004-02-20 14:45:50 +00:00
|
|
|
}
|
2004-02-25 21:59:16 +00:00
|
|
|
|
|
|
|
/* close connection */
|
2004-02-20 14:45:50 +00:00
|
|
|
mysqli_close($link);
|
2003-05-25 18:02:46 +00:00
|
|
|
?>
|
|
|
|
]]>
|
2004-02-25 21:59:16 +00:00
|
|
|
</programlisting>
|
|
|
|
</example>
|
2004-10-31 16:05:14 +00:00
|
|
|
&example.outputs;
|
2004-02-25 21:59:16 +00:00
|
|
|
<screen>
|
|
|
|
<![CDATA[
|
|
|
|
Errormessage: Unknown system variable 'a'
|
|
|
|
]]>
|
|
|
|
</screen>
|
|
|
|
</refsect1>
|
2003-03-15 23:01:35 +00:00
|
|
|
</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
|
|
|
|
-->
|