<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >dbase_get_record_with_names</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REL="HOME" TITLE="PHP 手册" HREF="index.html"><LINK REL="UP" TITLE="dBase Functions" HREF="ref.dbase.html"><LINK REL="PREVIOUS" TITLE="dbase_get_header_info" HREF="function.dbase-get-header-info.html"><LINK REL="NEXT" TITLE="dbase_get_record" HREF="function.dbase-get-record.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8"></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 手册</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.dbase-get-header-info.html" ACCESSKEY="P" >上一页</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.dbase-get-record.html" ACCESSKEY="N" >下一页</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.dbase-get-record-with-names" ></A >dbase_get_record_with_names</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN34095" ></A ><P > (PHP 3 >= 3.0.4, PHP 4, PHP 5)</P >dbase_get_record_with_names -- Gets a record from a database as an associative array </DIV ><DIV CLASS="refsect1" ><A NAME="AEN34098" ></A ><H2 >说明</H2 >array <B CLASS="methodname" >dbase_get_record_with_names</B > ( int dbase_identifier, int record_number )<BR ></BR ><P > Gets a record from a dBase database as an associative array. </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN34110" ></A ><H2 >参数</H2 ><P > <P ></P ><DIV CLASS="variablelist" ><DL ><DT ><CODE CLASS="parameter" >dbase_identifier</CODE ></DT ><DD ><P > The database link identifier, returned by <A HREF="function.dbase-open.html" ><B CLASS="function" >dbase_open()</B ></A > or <A HREF="function.dbase-create.html" ><B CLASS="function" >dbase_create()</B ></A >. </P ></DD ><DT ><CODE CLASS="parameter" >record_number</CODE ></DT ><DD ><P > The index of the record. </P ></DD ></DL ></DIV > </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN34126" ></A ><H2 >返回值</H2 ><P > An associative array with the record. This will also include a key named <TT CLASS="literal" >deleted</TT > which is set to 1 if the record has been marked for deletion (see <A HREF="function.dbase-delete-record.html" ><B CLASS="function" >dbase_delete_record()</B ></A >). </P ><P > Each field is converted to the appropriate PHP type, except: <P ></P ><UL ><LI ><P > Dates are left as strings. </P ></LI ><LI ><P > Integers that would have caused an overflow (> 32 bits) are returned as strings. </P ></LI ></UL > </P ><P > On error, <B CLASS="function" >dbase_get_record_with_names()</B > will return <TT CLASS="constant" ><B >FALSE</B ></TT >. </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN34140" ></A ><H2 >范例</H2 ><P > <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN34143" ></A ><P ><B >例 1. Listing all the registered members in the database</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><code><font color="#000000"> <font color="#0000BB"><?php<br /></font><font color="#FF8000">// open in read-only mode<br /></font><font color="#0000BB">$db </font><font color="#007700">= </font><font color="#0000BB">dbase_open</font><font color="#007700">(</font><font color="#DD0000">'/tmp/test.dbf'</font><font color="#007700">, </font><font color="#0000BB">0</font><font color="#007700">);<br /><br />if (</font><font color="#0000BB">$db</font><font color="#007700">) {<br /> </font><font color="#0000BB">$record_numbers </font><font color="#007700">= </font><font color="#0000BB">dbase_numrecords</font><font color="#007700">(</font><font color="#0000BB">$db</font><font color="#007700">);<br /> for (</font><font color="#0000BB">$i </font><font color="#007700">= </font><font color="#0000BB">1</font><font color="#007700">; </font><font color="#0000BB">$i </font><font color="#007700"><= </font><font color="#0000BB">$record_numbers</font><font color="#007700">; </font><font color="#0000BB">$i</font><font color="#007700">++) {<br /> </font><font color="#0000BB">$row </font><font color="#007700">= </font><font color="#0000BB">dbase_get_record_with_names</font><font color="#007700">(</font><font color="#0000BB">$db</font><font color="#007700">, </font><font color="#0000BB">$i</font><font color="#007700">);<br /> if (</font><font color="#0000BB">$row</font><font color="#007700">[</font><font color="#DD0000">'ismember'</font><font color="#007700">] == </font><font color="#0000BB">1</font><font color="#007700">) {<br /> echo </font><font color="#DD0000">"Member #$i: " </font><font color="#007700">. </font><font color="#0000BB">trim</font><font color="#007700">(</font><font color="#0000BB">$row</font><font color="#007700">[</font><font color="#DD0000">'name'</font><font color="#007700">]) . </font><font color="#DD0000">"\n"</font><font color="#007700">;<br /> }<br /> }<br />}<br /></font><font color="#0000BB">?></font> </font> </code></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE > </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN34146" ></A ><H2 >参见</H2 ><P > <P ></P ><TABLE BORDER="0" ><TBODY ><TR ><TD ><A HREF="function.dbase-get-record.html" ><B CLASS="function" >dbase_get_record()</B ></A ></TD ></TR ></TBODY ></TABLE ><P ></P > </P ></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.dbase-get-header-info.html" ACCESSKEY="P" >上一页</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >起始页</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.dbase-get-record.html" ACCESSKEY="N" >下一页</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >dbase_get_header_info</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.dbase.html" ACCESSKEY="U" >上一级</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >dbase_get_record</TD ></TR ></TABLE ></DIV ></BODY ></HTML >