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.8 $ -->
|
2003-03-15 23:01:35 +00:00
|
|
|
<refentry id="function.mysqli-stmt-error">
|
|
|
|
<refnamediv>
|
|
|
|
<refname>mysqli_stmt_error</refname>
|
2004-01-28 23:18:42 +00:00
|
|
|
<refname>mysqli_stmt->error</refname>
|
|
|
|
<refpurpose>Returns a string description for last statement error</refpurpose>
|
2003-03-15 23:01:35 +00:00
|
|
|
</refnamediv>
|
|
|
|
<refsect1>
|
|
|
|
<title>Description</title>
|
2004-01-28 23:18:42 +00:00
|
|
|
<para>Procedural style:</para>
|
|
|
|
<methodsynopsis>
|
|
|
|
<type>string</type><methodname>mysqli_stmt_error</methodname>
|
2004-11-12 14:01:04 +00:00
|
|
|
<methodparam><type>mysqli_stmt</type><parameter>stmt</parameter></methodparam>
|
2004-01-28 23:18:42 +00:00
|
|
|
</methodsynopsis>
|
|
|
|
<para>Object oriented style (property):</para>
|
|
|
|
<classsynopsis>
|
2004-11-12 14:01:04 +00:00
|
|
|
<ooclass><classname>mysqli_stmt</classname></ooclass>
|
2004-01-28 23:18:42 +00:00
|
|
|
<fieldsynopsis><type>string</type><varname>error</varname></fieldsynopsis>
|
|
|
|
</classsynopsis>
|
|
|
|
<para>
|
2004-06-11 14:09:55 +00:00
|
|
|
For the statement specified by <literal>stmt</literal>, <function>mysqli_stmt_error</function>
|
2004-01-28 23:18:42 +00:00
|
|
|
returns a containing the error message for the most recently invoked statement function that
|
|
|
|
can succeed or fail.
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
<refsect1>
|
2004-10-31 16:05:14 +00:00
|
|
|
&reftitle.returnvalues;
|
2004-01-28 23:18:42 +00:00
|
|
|
<para>
|
|
|
|
A string that describes the error. An empty string if no error occurred.
|
|
|
|
</para>
|
2003-03-15 23:01:35 +00:00
|
|
|
</refsect1>
|
2004-01-28 23:18:42 +00:00
|
|
|
<refsect1>
|
2004-10-31 16:05:14 +00:00
|
|
|
&reftitle.seealso;
|
2004-01-28 23:18:42 +00:00
|
|
|
<para>
|
2004-10-31 16:05:14 +00:00
|
|
|
<function>mysqli_stmt_errno</function>&listendand;
|
|
|
|
<function>mysqli_stmt_sqlstate</function>.
|
2004-01-28 23:18:42 +00:00
|
|
|
</para>
|
|
|
|
</refsect1>
|
2004-02-27 09:22:17 +00:00
|
|
|
<refsect1>
|
2004-10-31 16:05:14 +00:00
|
|
|
&reftitle.examples;
|
2004-02-27 09:22:17 +00:00
|
|
|
<example>
|
|
|
|
<title>Object oriented style</title>
|
|
|
|
<programlisting role="php">
|
|
|
|
<![CDATA[
|
|
|
|
<?php
|
|
|
|
/* Open a connection */
|
|
|
|
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
|
|
|
|
|
|
|
|
/* check connection */
|
|
|
|
if (mysqli_connect_errno()) {
|
|
|
|
printf("Connect failed: %s\n", mysqli_connect_error());
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
|
|
|
$mysqli->query("CREATE TABLE myCountry LIKE Country");
|
|
|
|
$mysqli->query("INSERT INTO myCountry SELECT * FROM Country");
|
|
|
|
|
|
|
|
|
|
|
|
$query = "SELECT Name, Code FROM myCountry ORDER BY Name";
|
|
|
|
if ($stmt = $mysqli->prepare($query)) {
|
|
|
|
|
|
|
|
/* drop table */
|
|
|
|
$mysqli->query("DROP TABLE myCountry");
|
|
|
|
|
|
|
|
/* execute query */
|
|
|
|
$stmt->execute();
|
|
|
|
|
|
|
|
printf("Error: %s.\n", $stmt->error);
|
|
|
|
|
|
|
|
/* close statement */
|
|
|
|
$stmt->close();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* close connection */
|
|
|
|
$mysqli->close();
|
|
|
|
?>
|
|
|
|
]]>
|
|
|
|
</programlisting>
|
|
|
|
</example>
|
|
|
|
<example>
|
|
|
|
<title>Procedural style</title>
|
|
|
|
<programlisting role="php">
|
|
|
|
<![CDATA[
|
|
|
|
<?php
|
|
|
|
/* Open a connection */
|
|
|
|
$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-01-28 23:18:42 +00:00
|
|
|
|
2004-02-27 09:22:17 +00:00
|
|
|
mysqli_query($link, "CREATE TABLE myCountry LIKE Country");
|
|
|
|
mysqli_query($link, "INSERT INTO myCountry SELECT * FROM Country");
|
|
|
|
|
|
|
|
|
|
|
|
$query = "SELECT Name, Code FROM myCountry ORDER BY Name";
|
|
|
|
if ($stmt = mysqli_prepare($link, $query)) {
|
|
|
|
|
|
|
|
/* drop table */
|
|
|
|
mysqli_query($link, "DROP TABLE myCountry");
|
|
|
|
|
|
|
|
/* execute query */
|
2004-03-09 17:21:48 +00:00
|
|
|
mysqli_stmt_execute($stmt);
|
2004-02-27 09:22:17 +00:00
|
|
|
|
|
|
|
printf("Error: %s.\n", mysqli_stmt_error($stmt));
|
|
|
|
|
|
|
|
/* close statement */
|
|
|
|
mysqli_stmt_close($stmt);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* close connection */
|
|
|
|
mysqli_close($link);
|
|
|
|
?>
|
|
|
|
]]>
|
|
|
|
</programlisting>
|
|
|
|
</example>
|
2004-10-31 16:05:14 +00:00
|
|
|
&example.outputs;
|
2004-02-27 09:22:17 +00:00
|
|
|
<screen>
|
|
|
|
<![CDATA[
|
|
|
|
Error: Table 'world.myCountry' doesn't exist.
|
|
|
|
]]>
|
|
|
|
</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
|
|
|
|
-->
|