<HTML ><HEAD ><TITLE >dbx_error</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="PHP Manual" HREF="index.html"><LINK REL="UP" TITLE="dbx functions" HREF="ref.dbx.html"><LINK REL="PREVIOUS" TITLE="dbx_connect" HREF="function.dbx-connect.html"><LINK REL="NEXT" TITLE="dbx_escape_string" HREF="function.dbx-escape-string.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=ISO-8859-1"></HEAD ><BODY CLASS="refentry" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >PHP Manual</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.dbx-connect.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.dbx-escape-string.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.dbx-error" ></A >dbx_error</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN17993" ></A ><P > (PHP 4 >= 4.0.6)</P >dbx_error -- Report the error message of the latest function call in the module (not just in the connection) </DIV ><DIV CLASS="refsect1" ><A NAME="AEN17996" ></A ><H2 >Description</H2 >string <B CLASS="methodname" >dbx_error</B > ( object link_identifier)<BR ></BR ><P > <B CLASS="function" >dbx_error()</B > returns a string containing the error message from the last function call of the abstracted module (e.g. mysql module). If there are multiple connections in the same module, just the last error is given. If there are connections on different modules, the latest error is returned for the module specified by the <TT CLASS="parameter" ><I >link_identifier</I ></TT > parameter. </P ><TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN18007" ></A ><P ><B >Example 1. <B CLASS="function" >dbx_error()</B > example</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="php" ><?php $link = dbx_connect(DBX_MYSQL, "localhost", "db", "username", "password") or die ("Could not connect"); $result = dbx_query($link, "select id from non_existing_table"); if ( $result == 0 ) { echo dbx_error ($link); } dbx_close ($link); ?></PRE ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >Note: </B > Always refer to the module-specific documentation as well. </P ><P > The error message for Microsoft SQL Server is actually the result of the <A HREF="function.mssql-get-last-message.html" ><B CLASS="function" >mssql_get_last_message()</B ></A > function. </P ><P > The error message for Oracle (oci8) is not implemented (yet). </P ></BLOCKQUOTE ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.dbx-connect.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.dbx-escape-string.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >dbx_connect</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.dbx.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >dbx_escape_string</TD ></TR ></TABLE ></DIV ></BODY ></HTML >