From 2067d1a727e7eb5e5ffb40e967f3d1fc4c8a41b2 Mon Sep 17 00:00:00 2001 From: Derek Allard Date: Thu, 13 Nov 2008 22:59:24 +0000 Subject: Changing EOL style to LF --- user_guide/database/fields.html | 324 ++++++++++++++++++++-------------------- 1 file changed, 162 insertions(+), 162 deletions(-) (limited to 'user_guide/database/fields.html') diff --git a/user_guide/database/fields.html b/user_guide/database/fields.html index ed8f63d63..067d5b69c 100644 --- a/user_guide/database/fields.html +++ b/user_guide/database/fields.html @@ -1,163 +1,163 @@ - - - - - -Field Data : CodeIgniter User Guide - - - - - - - - - - - - - - - - - - - - - -
- - - - - -

CodeIgniter User Guide Version 1.7

-
- - - - - - - - -
- - - -
- - - -
- - -

Field Data

- - -

$this->db->list_fields()

-

Returns an array containing the field names. This query can be called two ways:

- - -

1. You can supply the table name and call it from the $this->db-> object:

- - -$fields = $this->db->list_fields('table_name');

- -foreach ($fields as $field)
-{
-   echo $field;
-} -
- -

2. You can gather the field names associated with any query you run by calling the function -from your query result object:

- - -$query = $this->db->query('SELECT * FROM some_table'); -

- -foreach ($query->list_fields() as $field)
-{
-   echo $field;
-} -
- - -

$this->db->field_exists()

- -

Sometimes it's helpful to know whether a particular field exists before performing an action. -Returns a boolean TRUE/FALSE. Usage example:

- - -if ($this->db->field_exists('field_name', 'table_name'))
-{
-   // some code...
-} -
- -

Note: Replace field_name with the name of the column you are looking for, and replace -table_name with the name of the table you are looking for.

- - -

$this->db->field_data()

-

Returns an array of objects containing field information.

-

Sometimes it's helpful to gather the field names or other metadata, like the column type, max length, etc.

- - -

Note: Not all databases provide meta-data.

- -

Usage example:

- - -$fields = $this->db->field_data('table_name');

- -foreach ($fields as $field)
-{
-   echo $field->name;
-   echo $field->type;
-   echo $field->max_length;
-   echo $field->primary_key;
-} -
- -

If you have run a query already you can use the result object instead of supplying the table name:

- - -$query = $this->db->query("YOUR QUERY");
-$fields = $query->field_data(); -
- - -

The following data is available from this function if supported by your database:

- - - - -
- - - - - - + + + + + +Field Data : CodeIgniter User Guide + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +

CodeIgniter User Guide Version 1.7

+
+ + + + + + + + +
+ + + +
+ + + +
+ + +

Field Data

+ + +

$this->db->list_fields()

+

Returns an array containing the field names. This query can be called two ways:

+ + +

1. You can supply the table name and call it from the $this->db-> object:

+ + +$fields = $this->db->list_fields('table_name');

+ +foreach ($fields as $field)
+{
+   echo $field;
+} +
+ +

2. You can gather the field names associated with any query you run by calling the function +from your query result object:

+ + +$query = $this->db->query('SELECT * FROM some_table'); +

+ +foreach ($query->list_fields() as $field)
+{
+   echo $field;
+} +
+ + +

$this->db->field_exists()

+ +

Sometimes it's helpful to know whether a particular field exists before performing an action. +Returns a boolean TRUE/FALSE. Usage example:

+ + +if ($this->db->field_exists('field_name', 'table_name'))
+{
+   // some code...
+} +
+ +

Note: Replace field_name with the name of the column you are looking for, and replace +table_name with the name of the table you are looking for.

+ + +

$this->db->field_data()

+

Returns an array of objects containing field information.

+

Sometimes it's helpful to gather the field names or other metadata, like the column type, max length, etc.

+ + +

Note: Not all databases provide meta-data.

+ +

Usage example:

+ + +$fields = $this->db->field_data('table_name');

+ +foreach ($fields as $field)
+{
+   echo $field->name;
+   echo $field->type;
+   echo $field->max_length;
+   echo $field->primary_key;
+} +
+ +

If you have run a query already you can use the result object instead of supplying the table name:

+ + +$query = $this->db->query("YOUR QUERY");
+$fields = $query->field_data(); +
+ + +

The following data is available from this function if supported by your database:

+ + + + +
+ + + + + + \ No newline at end of file -- cgit v1.2.3-24-g4f1b