php-doc-en/reference/maxdb/functions/maxdb-field-tell.xml
Thomas Simenec ad2d322256 Update documentation
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@181642 c90b9560-bf6c-de11-be94-00142212c4b1
2005-03-08 16:39:06 +00:00

167 lines
4.1 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.2 $ -->
<refentry id="function.maxdb-field-tell">
<refnamediv>
<refname>maxdb_field_tell</refname>
<refname>result->current_field</refname>
<refpurpose>
Get current field offset of a result pointer
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<para>Procedural style:</para>
<methodsynopsis>
<type>int</type><methodname>maxdb_field_tell</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
</methodsynopsis>
<para>Object oriented style (property):</para>
<classsynopsis>
<ooclass><classname>result</classname></ooclass>
<fieldsynopsis>
<type>int</type>
<varname>current_field</varname>
</fieldsynopsis>
</classsynopsis>
<para>
Returns the position of the field cursor used for the last
<function>maxdb_fetch_field</function> call. This value can
be used as an argument to <function>maxdb_field_seek</function>.
</para>
</refsect1>
<refsect1>
&reftitle.returnvalues;
<para>
Returns current offset of field cursor.
</para>
</refsect1>
<refsect1>
&reftitle.seealso;
<para>
<function>maxdb_fetch_field</function>,
<function>maxdb_field_seek</function>
</para>
</refsect1>
<refsect1>
<title>Example</title>
<example>
<title>Object oriented style</title>
<programlisting role="php">
<![CDATA[
<?php
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
/* check connection */
if (maxdb_connect_errno()) {
printf("Connect failed: %s\n", maxdb_connect_error());
exit();
}
$query = "SELECT name, cno from hotel.customer ORDER BY cno";
if ($result = $maxdb->query($query)) {
/* Get field information for all columns */
while ($finfo = $result->fetch_field()) {
/* get fieldpointer offset */
$currentfield = $result->current_field;
printf("Column %d:\n", $currentfield);
printf("Name: %s\n", $finfo->name);
printf("Table: %s\n", $finfo->table);
printf("max. Len: %d\n", $finfo->max_length);
printf("Flags: %d\n", $finfo->flags);
printf("Type: %d\n\n", $finfo->type);
}
$result->close();
}
/* close connection */
$maxdb->close();
?>
]]>
</programlisting>
</example>
<example>
<title>Procedural style</title>
<programlisting role="php">
<![CDATA[
<?php
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
/* check connection */
if (maxdb_connect_errno()) {
printf("Connect failed: %s\n", maxdb_connect_error());
exit();
}
$query = "SELECT name, cno from hotel.customer ORDER BY cno";
if ($result = maxdb_query($link, $query)) {
/* Get field information for all fields */
while ($finfo = maxdb_fetch_field($result)) {
/* get fieldpointer offset */
$currentfield = maxdb_field_tell($result);
printf("Column %d:\n", $currentfield);
printf("Name: %s\n", $finfo->name);
printf("Table: %s\n", $finfo->table);
printf("max. Len: %d\n", $finfo->max_length);
printf("Flags: %d\n", $finfo->flags);
printf("Type: %d\n\n", $finfo->type);
}
maxdb_free_result($result);
}
/* close connection */
maxdb_close($link);
?>
]]>
</programlisting>
</example>
<para>
The above examples would produce the following output:
</para>
<screen>
<![CDATA[
Column 1:
Name: NAME
Table:
max. Len: 10
Flags: -1
Type: 2
Column 2:
Name: CNO
Table:
max. Len: 4
Flags: -1
Type: 0
]]>
</screen>
</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
-->