php-doc-en/reference/maxdb/functions/maxdb-fetch-field-count.xml
Thomas Simenec c5ff12273c MaxDB PHP documentation
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@177090 c90b9560-bf6c-de11-be94-00142212c4b1
2005-01-12 18:53:25 +00:00

85 lines
2.4 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1.1.1 $ -->
<refentry id="function.maxdb-field-count">
<refnamediv>
<refname>maxdb_field_count</refname>
<refpurpose>Returns the number of columns for the most recent query</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<para>Procedural style:</para>
<methodsynopsis>
<type>int</type><methodname>maxdb_field_count</methodname>
<methodparam><type>resource</type><parameter>link</parameter></methodparam>
</methodsynopsis>
<para>
Returns the number of columns for the most recent query on the connection
represented by the <parameter>link</parameter> parameter. This function
can be useful when using the <function>maxdb_store_result</function>
function to determine if the query should have produced a non-empty result
set or not without knowing the nature of the query.
</para>
</refsect1>
<refsect1>
<title>Return values</title>
<para>An integer representing the number of fields in a result set</para>
</refsect1>
<refsect1>
<title>Example</title>
<para>
<example>
<title>Procedural style</title>
<programlisting role='php'>
<![CDATA[
<?php
$link = maxdb_connect("localhost", "my_user", "my_password", "test");
maxdb_query($link, "DROP TABLE friends");
maxdb_query($link, "CREATE TABLE friends (id int, name varchar(20))");
maxdb_query($link, "INSERT INTO friends VALUES (1,'Hartmut')");
maxdb_query($link, "INSERT INTO friends VALUES (2, 'Ulf')");
maxdb_real_query($link, $HTTP_POST_VARS['query']);
if (maxdb_field_count($link)) {
/* this was a select/show or describe query */
$result = maxdb_store_result($link);
/* process resultset */
$row = maxdb_fetch_row($result);
/* free resultset */
maxdb_free_result($result);
}
/* close connection */
maxdb_close($link);
?>
]]>
</programlisting>
</example>
</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
-->