diff options
author | Barry Mieny <barry@mieny.com> | 2010-10-04 16:33:58 +0200 |
---|---|---|
committer | Barry Mieny <barry@mieny.com> | 2010-10-04 16:33:58 +0200 |
commit | dd6719738936be31cdaa1758ca86d5eb14dcab3d (patch) | |
tree | b5ef66e31b2d0f4f2c1cbccc367bde92c156e1f9 /user_guide/database | |
parent | 3351fbc56cea19ec3dd603836beb0a420b1ded65 (diff) |
Cleanup of stray spaces and tabs
Diffstat (limited to 'user_guide/database')
-rw-r--r-- | user_guide/database/active_record.html | 74 | ||||
-rw-r--r-- | user_guide/database/call_function.html | 2 | ||||
-rw-r--r-- | user_guide/database/fields.html | 2 | ||||
-rw-r--r-- | user_guide/database/index.html | 2 | ||||
-rw-r--r-- | user_guide/database/queries.html | 2 | ||||
-rw-r--r-- | user_guide/database/results.html | 30 | ||||
-rw-r--r-- | user_guide/database/table_data.html | 2 |
7 files changed, 57 insertions, 57 deletions
diff --git a/user_guide/database/active_record.html b/user_guide/database/active_record.html index 482115ccd..065db4913 100644 --- a/user_guide/database/active_record.html +++ b/user_guide/database/active_record.html @@ -220,20 +220,20 @@ $this->db->join('comments', 'comments.id = blogs.id', <strong>'left'</strong>);< <code>$this->db->where('name', $name); <br /><br />// Produces: WHERE name = 'Joe' </code> - + <p>Notice that the equal sign is added for you.</p> - + <p>If you use multiple function calls they will be chained together with <var>AND</var> between them:</p> - + <code>$this->db->where('name', $name);<br /> $this->db->where('title', $title);<br /> $this->db->where('status', $status); <br /><br />// WHERE name = 'Joe' AND title = 'boss' AND status = 'active' </code> </li> - + <li><strong>Custom key/value method:</strong> - + <p>You can include an operator in the first parameter in order to control the comparison:</p> - + <code>$this->db->where('name !=', $name);<br /> $this->db->where('id <', $id); <br /><br />// Produces: WHERE name != 'Joe' AND id < 45 </code> </li> @@ -242,7 +242,7 @@ $this->db->join('comments', 'comments.id = blogs.id', <strong>'left'</strong>);< <code> $array = array('name' => $name, 'title' => $title, 'status' => $status);<br /><br /> - + $this->db->where($array); <br /><br />// Produces: WHERE name = 'Joe' AND title = 'boss' AND status = 'active' </code> @@ -250,10 +250,10 @@ $this->db->join('comments', 'comments.id = blogs.id', <strong>'left'</strong>);< <code> $array = array('name !=' => $name, 'id <' => $id, 'date >' => $date);<br /><br /> - + $this->db->where($array);</code> </li> <li><strong>Custom string:</strong> - + <p>You can write your own clauses manually:</p> <code> @@ -263,7 +263,7 @@ $this->db->join('comments', 'comments.id = blogs.id', <strong>'left'</strong>);< <p>$this->db->where() accepts an optional third parameter. If you set it to FALSE, CodeIgniter will not try to protect your field or table names with backticks.</p> -<p><code> $this->db->where('MATCH (field) AGAINST ("value")', NULL, FALSE);<br /> +<p><code> $this->db->where('MATCH (field) AGAINST ("value")', NULL, FALSE);<br /> </code></p> <h2>$this->db->or_where();</h2> <p>This function is identical to the one above, except that multiple instances are joined by OR:</p> @@ -290,7 +290,7 @@ $this->db->or_where('id >', $id); $names = array('Frank', 'Todd', 'James');<br /> $this->db->or_where_in('username', $names);<br /> // Produces: OR username IN ('Frank', 'Todd', 'James')</code></p> - + <h2>$this->db->where_not_in();</h2> <p>Generates a WHERE field NOT IN ('item', 'item') SQL query joined with AND if appropriate</p> <p><code> @@ -316,14 +316,14 @@ $this->db->or_where('id >', $id); <code>$this->db->like('title', 'match'); <br /><br />// Produces: WHERE title LIKE '%match%' </code> - + <p>If you use multiple function calls they will be chained together with <var>AND</var> between them:</p> - + <code>$this->db->like('title', 'match');<br /> $this->db->like('body', 'match'); <br /><br /> // WHERE title LIKE '%match%' AND body LIKE '%match%</code> - If you want to control where the wildcard (%) is placed, you can use an optional third argument. Your options are 'before', 'after' and 'both' (which is the default). + If you want to control where the wildcard (%) is placed, you can use an optional third argument. Your options are 'before', 'after' and 'both' (which is the default). <code>$this->db->like('title', 'match', 'before'); <br /> // Produces: WHERE title LIKE '%match' <br /> @@ -333,17 +333,17 @@ $this->db->or_where('id >', $id); <br /> $this->db->like('title', 'match', 'both'); <br /> // Produces: WHERE title LIKE '%match%' </code> </li> - + <li><strong>Associative array method:</strong> <code> $array = array('title' => $match, 'page1' => $match, 'page2' => $match);<br /><br /> - + $this->db->like($array); <br /><br />// WHERE title LIKE '%match%' AND page1 LIKE '%match%' AND page2 LIKE '%match%'</code></li> </ol> - - + + <h2>$this->db->or_like();</h2> <p>This function is identical to the one above, except that multiple instances are joined by OR:</p> @@ -355,7 +355,7 @@ $this->db->or_like('body', $match); - + <p class="important">Note: or_like() was formerly known as orlike(), which has been removed.</p> <h2>$this->db->not_like();</h2> <p>This function is identical to <strong>like()</strong>, except that it generates NOT LIKE statements:</p> @@ -370,17 +370,17 @@ $this->db->or_not_like('body', 'match'); <br /> // WHERE title LIKE '%match% OR body NOT LIKE '%match%'</code> <h2>$this->db->group_by();</h2> <p>Permits you to write the GROUP BY portion of your query:</p> - + <code>$this->db->group_by("title"); <br /><br />// Produces: GROUP BY title </code> <p>You can also pass an array of multiple values as well:</p> - + <code>$this->db->group_by(array("title", "date")); <br /> <br />// Produces: GROUP BY title, date</code> - + <p class="important">Note: group_by() was formerly known as groupby(), which has been removed. </p> <h2> $this->db->distinct();<br /> @@ -392,7 +392,7 @@ $this->db->or_not_like('body', 'match'); <br /> // Produces: SELECT DISTINCT * FROM table</code></p> <h2>$this->db->having();</h2> <p>Permits you to write the HAVING portion of your query. There are 2 possible syntaxes, 1 argument or 2:</p> - + <code>$this->db->having('user_id = 45'); <br /> // Produces: HAVING user_id = 45<br /> @@ -401,7 +401,7 @@ $this->db->having('user_id', 45); <br /> // Produces: HAVING user_id = 45<br /> <br /> </code> - + <p>You can also pass an array of multiple values as well:</p> @@ -419,14 +419,14 @@ $this->db->having('user_id', 45); <br /> <h2>$this->db->order_by();</h2> <p>Lets you set an ORDER BY clause. The first parameter contains the name of the column you would like to order by. The second parameter lets you set the direction of the result. Options are <kbd>asc</kbd> or <kbd>desc</kbd>, or <kbd>random</kbd>. </p> - + <code>$this->db->order_by("title", "desc"); <br /> <br />// Produces: ORDER BY title DESC </code> <p>You can also pass your own string in the first parameter:</p> - + <code>$this->db->order_by('title desc, name asc'); <br /> <br />// Produces: ORDER BY title DESC, name ASC @@ -479,10 +479,10 @@ echo $this->db->count_all_results();<br /> // Produces an integer, like 25</code> - + <a name="insert"> </a> <h1>Inserting Data</h1> - + <h2>$this->db->insert();</h2> <p>Generates an insert string based on the data you supply, and runs the query. You can either pass an <strong>array</strong> or an <strong>object</strong> to the function. Here is an example using an array:</p> @@ -520,9 +520,9 @@ $this->db->insert('mytable', $object); <p>The first parameter will contain the table name, the second is an associative array of values.</p> <p class="important"><strong>Note:</strong> All values are escaped automatically producing safer queries.</p> - - - + + + <h2>$this->db->set();</h2> <p>This function enables you to set values for <dfn>inserts</dfn> or <dfn>updates</dfn>.</p> @@ -576,10 +576,10 @@ $this->db->insert('mytable'); </code> - + <a name="update"> </a> <h1>Updating Data</h1> - + <h2>$this->db->update();</h2> <p>Generates an update string and runs the query based on the data you supply. You can pass an <strong>array</strong> or an <strong>object</strong> to the function. Here is an example using @@ -625,7 +625,7 @@ $this->db->update('mytable', $object); <p class="important"><strong>Note:</strong> All values are escaped automatically producing safer queries.</p> - + <p>You'll notice the use of the <dfn>$this->db->where()</dfn> function, enabling you to set the WHERE clause. You can optionally pass this information directly into the update function as a string:</p> @@ -634,15 +634,15 @@ You can optionally pass this information directly into the update function as a <p>Or as an array:</p> <code>$this->db->update('mytable', $data, array('id' => $id));</code> - + <p>You may also use the <dfn>$this->db->set()</dfn> function described above when performing updates.</p> - + <a name="delete"> </a> <h1>Deleting Data</h1> - + <h2>$this->db->delete();</h2> <p>Generates a delete SQL string and runs the query.</p> diff --git a/user_guide/database/call_function.html b/user_guide/database/call_function.html index fe09d2b14..46dfe89dc 100644 --- a/user_guide/database/call_function.html +++ b/user_guide/database/call_function.html @@ -97,7 +97,7 @@ Obviously not all function calls are identical between platforms, so there are l - + </div> <!-- END CONTENT --> diff --git a/user_guide/database/fields.html b/user_guide/database/fields.html index 30d39a42d..e5cc4777d 100644 --- a/user_guide/database/fields.html +++ b/user_guide/database/fields.html @@ -142,7 +142,7 @@ $fields = $query->field_data(); <li>primary_key - 1 if the column is a primary key</li> <li>type - the type of the column</li> </ul> - + </div> <!-- END CONTENT --> diff --git a/user_guide/database/index.html b/user_guide/database/index.html index 45d15dba4..381592c26 100644 --- a/user_guide/database/index.html +++ b/user_guide/database/index.html @@ -78,7 +78,7 @@ structures and Active Record patterns. The database functions offer clear, simpl <li><a href="forge.html">Database manipulation with Database Forge</a></li> <li><a href="utilities.html">Database Utilities Class</a></li> </ul> - + </div> <!-- END CONTENT --> diff --git a/user_guide/database/queries.html b/user_guide/database/queries.html index 7a6734c4a..c8a304943 100644 --- a/user_guide/database/queries.html +++ b/user_guide/database/queries.html @@ -132,7 +132,7 @@ $this->db->query($sql, array(3, 'live', 'Rick')); <p>The question marks in the query are automatically replaced with the values in the array in the second parameter of the query function.</p> <p class="important">The secondary benefit of using binds is that the values are automatically escaped, producing safer queries. You don't have to remember to manually escape data; the engine does it automatically for you.</p> - + </div> <!-- END CONTENT --> 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 echo $row->name;<br /> 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 }<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 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 --> diff --git a/user_guide/database/table_data.html b/user_guide/database/table_data.html index c85408fab..8b86ed58e 100644 --- a/user_guide/database/table_data.html +++ b/user_guide/database/table_data.html @@ -92,7 +92,7 @@ if ($this->db->table_exists('table_name'))<br /> - + </div> <!-- END CONTENT --> |