cvs: peardoc /en/package/structures/structures-datagrid/structures-datagrid addrecord.xml

From: Date: Fri, 28 Jan 2005 15:31:36 +0000
Subject: cvs: peardoc /en/package/structures/structures-datagrid/structures-datagrid addrecord.xml
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-5491@lists.php.net to get a copy of this message
asnagy Fri Jan 28 10:31:36 2005 EDT Added files: /peardoc/en/package/structures/structures-datagrid/structures-datagrid addrecord.xml Log: Intial checkin http://cvs.php.net/co.php/peardoc/en/package/structures/structures-datagrid/structures-datagrid/addrecord.xml?r=1.1&p=1 Index: peardoc/en/package/structures/structures-datagrid/structures-datagrid/addrecord.xml +++ peardoc/en/package/structures/structures-datagrid/structures-datagrid/addrecord.xml <?xml version="1.0" encoding="iso-8859-1" ?> <!-- $Revision: 1.1 $ --> <refentry id="package.structures.structures_datagrid.structures_datagrid.addrecord"> <refnamediv> <refname>Structures_DataGrid::addRecord()</refname> <refpurpose> Adds a Structures_DataGrid_Record object to the DataGrid's record collection </refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcprototype> <funcdef>array <function>Structures_DataGrid::addRecord</function></funcdef> <paramdef> Structures_DataGrid_Record <parameter>$record</parameter> </paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.structures.structures_datagrid.structures_datagrid.addrecord.desc"> &title.desc; <para> This method adds a record in array format, prefferably an assosiative array, to the Record Collection. If you have an array of associative arrays, such as a record set from a database or an <acronym>XML</acronym> or <acronym>CSV</acronym> document, you will be better of to use the <link linkend="package.structures.structures-datagrid.structures-datagrid.bind"><function>bind</function></link> method. </para> </refsect1> <refsect1 id="package.structures.structures_datagrid.structures_datagrid.addrecord.parameter"> &title.param; <para> <variablelist> <varlistentry> <term> <classname>Structures_DataGrid_Record</classname> <parameter>$record</parameter> </term> <listitem> <para> The &class.structures-datagrid-record object to be added to the Record Collection. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 id="package.structures.structures_datagrid.structures_datagrid.addrecord.note"> &title.note; <para> If you would like to add a DB_DataObject or DB_Result record, you can use this method but you will need to use the Structures_DataGrid_Record_DataObject or Structures_DataGrid_Record_DB class respectively. However, this practice for the DB_DataObject and DB_Result should only be used if absolutely necessary as the bind method is the preferred method. </para> </refsect1> <refsect1 id="package.structures.structures_datagrid.structures_datagrid.addrecord.example"> &title.example; <example> <title>Adding a record set from a MySql database</title> <programlisting role="php"> <![CDATA[ <?php require_once 'Structures/DataGrid.php'; $conn = mysql_connect(...my database connection...); $db = mysql_select_db(... my db ...); $dg =& new Structures_DataGrid(); $result = mysql_query("SELECT * FROM user WHERE hair = 'Red'"); while ($record = mysql_fetch_assoc($result)) { $dg->addRecord(new Structures_DataGrid_Record($record)); } $dg->render(); ?> ]]> </programlisting> </example> </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 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 -->

« previous php.pear.doc (#5491) next »