<?xml version="1.0" encoding="utf-8"?> <!-- $Revision$ --> <!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.82 --> <refentry xml:id='function.pg-result-error' xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>pg_result_error</refname> <refpurpose> Get error message associated with result </refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>string</type><methodname>pg_result_error</methodname> <methodparam><type>resource</type><parameter>result</parameter></methodparam> </methodsynopsis> <para> <function>pg_result_error</function> returns any error message associated with the <parameter>result</parameter> resource. Therefore, the user has a better chance of getting the correct error message than with <function>pg_last_error</function>. </para> <para> The function <function>pg_result_error_field</function> can give much greater detail on result errors than <function>pg_result_error</function>. </para> <para> Because <function>pg_query</function> returns &false; if the query fails, you must use <function>pg_send_query</function> and <function>pg_get_result</function> to get the result handle. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>result</parameter></term> <listitem> <para> PostgreSQL query result resource, returned by <function>pg_query</function>, <function>pg_query_params</function> or <function>pg_execute</function> (among others). </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> Returns a <type>string</type>. Returns empty string if there is no error. If there is an error associated with the <parameter>result</parameter> parameter, returns &false;. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title><function>pg_result_error</function> example</title> <programlisting role="php"> <![CDATA[ <?php $dbconn = pg_connect("dbname=publisher") or die("Could not connect"); if (!pg_connection_busy($dbconn)) { pg_send_query($dbconn, "select * from doesnotexist;"); } $res1 = pg_get_result($dbconn); echo pg_result_error($res1); ?> ]]> </programlisting> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>pg_result_error_field</function></member> <member><function>pg_query</function></member> <member><function>pg_send_query</function></member> <member><function>pg_get_result</function></member> <member><function>pg_last_error</function></member> <member><function>pg_last_notice</function></member> </simplelist> </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:"~/.phpdoc/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 -->