summaryrefslogtreecommitdiffstats
path: root/user_guide/database
diff options
context:
space:
mode:
authorDerek Allard <derek.allard@ellislab.com>2007-12-18 16:58:03 +0100
committerDerek Allard <derek.allard@ellislab.com>2007-12-18 16:58:03 +0100
commit694b5b8ee6a40b57c91be3c5448bc8f5540d32d8 (patch)
treee79f794d18e31113ef086d76772c49c81b6b3cf1 /user_guide/database
parent04036f33f6af540ce371b1ebd1878018f0816ed8 (diff)
Added count_all_results() function to Active Record.
Diffstat (limited to 'user_guide/database')
-rw-r--r--user_guide/database/active_record.html13
1 files changed, 12 insertions, 1 deletions
diff --git a/user_guide/database/active_record.html b/user_guide/database/active_record.html
index 1c4783ab9..d608459e4 100644
--- a/user_guide/database/active_record.html
+++ b/user_guide/database/active_record.html
@@ -392,6 +392,18 @@ $this->db->limit(10, 20);<br />
// Produces: LIMIT 20, 10 (in MySQL. Other databases have slightly different syntax)</code>
+<h2>$this->db->count_all_results();</h2>
+
+<p>Permits you to determine the number of rows in a particular Active Record query. Queries will accept Active Record restrictors such as where(), or_where(), like(), or_like(), etc. Example:</p>
+<code>echo $this->db->count_all_results('<var>my_table</var>');<br />
+
+// Produces an integer, like 25<br />
+<br />
+$this-&gt;db-&gt;like('title', 'match');<br />
+$this-&gt;db-&gt;from('<var>my_table</var>');<br />
+echo $this-&gt;db-&gt;count_all_results();<br />
+// Produces an integer, like 17 </code>
+
<h2>$this->db->count_all();</h2>
<p>Permits you to determine the number of rows in a particular table. Submit the table name in the first parameter. Example:</p>
@@ -401,7 +413,6 @@ $this->db->limit(10, 20);<br />
// Produces an integer, like 25</code>
-
<a name="insert">&nbsp;</a>
<h1>Inserting Data</h1>