Changeset 136
- Timestamp:
- 05/31/2007 11:29:35 AM (18 months ago)
- Files:
-
- 1 modified
-
trunk/user_guide/database/active_record.html (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/user_guide/database/active_record.html
r29 r136 87 87 </ul> 88 88 89 90 91 92 89 <a name="select"> </a> 93 90 <h1>Selecting Data</h1> … … 97 94 <p><strong>Note: If you are using PHP 5 you can use method chaining for more compact syntax. This is described at the end of the page.</strong></p> 98 95 99 100 96 <h2>$this->db->get();</h2> 101 97 … … 111 107 <br /> 112 108 // Produces: SELECT * FROM mytable LIMIT 20, 10 (in MySQL. Other databases have slightly different syntax)</code> 113 114 115 109 116 110 <p>You'll notice that the above function is assigned to a variable named <kbd>$query</kbd>, which can be used to show the results:</p> … … 395 389 396 390 397 398 391 <h2>$this->db->count_records();</h2> 392 393 <p>Permits you to determine the number of rows in a particular query, without actually making the query. Submit the table name 394 in the first parameter. Example:</p> 395 396 <code>$this->db->where('<var>some_field</var>', 20);<br /> 397 $this->db->count_records('<var>my_table</var>'); 398 <br /> 399 // Produces an integer, like 10</code> 400 401 <p class="important"><strong>Note:</strong> This function differs from <kbd>count_all</kbd> in that it allows you to use 402 <kbd>where</kbd> before counting the rows.</p> 403 404 399 405 <a name="insert"> </a> 400 406 <h1>Inserting Data</h1>
