diff options
author | admin <devnull@localhost> | 2006-09-26 00:12:32 +0200 |
---|---|---|
committer | admin <devnull@localhost> | 2006-09-26 00:12:32 +0200 |
commit | ab4f61bacfa022c0c7238e9661ad9cb2ac440d95 (patch) | |
tree | d0374898fd8e6452b36728fa75030e4ab72ea35e /user_guide | |
parent | e106318c19938c621198924ab5d292592dbb4477 (diff) |
Diffstat (limited to 'user_guide')
-rw-r--r-- | user_guide/database/fields.html | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/user_guide/database/fields.html b/user_guide/database/fields.html index 7cf1f9c4e..ecb6fcb45 100644 --- a/user_guide/database/fields.html +++ b/user_guide/database/fields.html @@ -66,10 +66,13 @@ Field Names <h2>Retrieving Field Names</h2>
-<p>Sometimes it's helpful to gather the field names.</p>
+<p>Sometimes it's helpful to gather the field names for a particular table or with a paritcular query result.</p>
<h2>$this->db->field_names();</h2>
-<p>Returns an array containing the field names. You must supply the table name to the function:</p>
+<p>Returns an array containing the field names. This query can be called two ways:</p>
+
+
+<p>1. You can supply the table name and call it from the <dfn>$this->db-></dfn> object:</p>
<code>
$fields = $this->db->field_names('table_name');<br /><br />
@@ -80,6 +83,21 @@ foreach ($fields as $field)<br /> }
</code>
+<p>2. You can gather the feild names associated with any query you run by calling the function
+from your query result object:</p>
+
+<code>
+$query = $this->db->query('SELECT * FROM some_table');
+<br /><br />
+
+foreach ($query->field_names() as $field)<br />
+{<br />
+ echo $field;<br />
+}
+</code>
+
+
+
<h2>Retrieving Field MetaData</h2>
|