summaryrefslogtreecommitdiffstats
path: root/user_guide/database/results.html
diff options
context:
space:
mode:
authorPascal Kriete <pascal.kriete@ellislab.com>2010-11-04 22:59:52 +0100
committerPascal Kriete <pascal.kriete@ellislab.com>2010-11-04 22:59:52 +0100
commite917f9be8b05c81357c1c2c9730d5060685d644d (patch)
treeb6a7d5ce8ba57b69ba61454f77829b04f2ce5974 /user_guide/database/results.html
parent5b2d2da5ae2e97043c6bef53e565d30e50196e2b (diff)
parente1f6e9ddff788f6a154f5f35dc117d14aeb0c484 (diff)
Automated merge with http://hg.ellislab.com/CodeIgniter2
Diffstat (limited to 'user_guide/database/results.html')
-rw-r--r--user_guide/database/results.html30
1 files changed, 15 insertions, 15 deletions
diff --git a/user_guide/database/results.html b/user_guide/database/results.html
index 9eaa1793e..410dac840 100644
--- a/user_guide/database/results.html
+++ b/user_guide/database/results.html
@@ -65,11 +65,11 @@ Query Results
<p>There are several ways to generate query results:</p>
<h2>result()</h2>
-
+
<p>This function returns the query result as an array of <strong>objects</strong>, or <strong>an empty array</strong> on failure.
-
+
Typically you'll use this in a foreach loop, like this:</p>
-
+
<code>
$query = $this->db->query("YOUR QUERY");<br />
<br />
@@ -79,11 +79,11 @@ Query Results
&nbsp;&nbsp;&nbsp;echo $row->name;<br />
&nbsp;&nbsp;&nbsp;echo $row->body;<br />
}</code>
-
+
<p>The above <dfn>function</dfn> is an alias of <dfn>result_object()</dfn>.</p>
<p>If you run queries that might <strong>not</strong> produce a result, you are encouraged to test the result first:</p>
-
+
<code>
$query = $this->db->query("YOUR QUERY");<br />
<br />
@@ -97,9 +97,9 @@ Query Results
&nbsp;&nbsp;&nbsp;}<br />
}
</code>
-
+
<h2>result_array()</h2>
-
+
<p>This function returns the query result as a pure array, or an empty array when no result is produced. Typically you'll use this in a foreach loop, like this:</p>
<code>
$query = $this->db->query("YOUR QUERY");<br />
@@ -113,7 +113,7 @@ Query Results
<h2>row()</h2>
-
+
<p>This function returns a single result row. If your query has more than one row, it returns only the first row.
The result is returned as an <strong>object</strong>. Here's a usage example:</p>
<code>
@@ -128,9 +128,9 @@ Query Results
&nbsp;&nbsp;&nbsp;echo $row->body;<br />
}
</code>
-
+
<p>If you want a specific row returned you can submit the row number as a digit in the first parameter:</p>
-
+
<code>$row = $query->row(<dfn>5</dfn>);</code>
@@ -151,13 +151,13 @@ Query Results
}
</code>
-
+
<p>If you want a specific row returned you can submit the row number as a digit in the first parameter:</p>
-
+
<code>$row = $query->row_array(<dfn>5</dfn>);</code>
-
- <p>In addition, you can walk forward/backwards/first/last through your results using these variations:</p>
+
+ <p>In addition, you can walk forward/backwards/first/last through your results using these variations:</p>
<p>
<strong>$row = $query->first_row()</strong><br />
@@ -217,7 +217,7 @@ $query2->free_result(); // The $query2 result object will no longer be availabl
-
+
</div>
<!-- END CONTENT -->