diff options
author | Derek Allard <derek.allard@ellislab.com> | 2007-12-18 16:58:03 +0100 |
---|---|---|
committer | Derek Allard <derek.allard@ellislab.com> | 2007-12-18 16:58:03 +0100 |
commit | 694b5b8ee6a40b57c91be3c5448bc8f5540d32d8 (patch) | |
tree | e79f794d18e31113ef086d76772c49c81b6b3cf1 /user_guide/database | |
parent | 04036f33f6af540ce371b1ebd1878018f0816ed8 (diff) |
Added count_all_results() function to Active Record.
Diffstat (limited to 'user_guide/database')
-rw-r--r-- | user_guide/database/active_record.html | 13 |
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->db->like('title', 'match');<br />
+$this->db->from('<var>my_table</var>');<br />
+echo $this->db->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"> </a>
<h1>Inserting Data</h1>
|