summaryrefslogtreecommitdiffstats
path: root/user_guide/database
diff options
context:
space:
mode:
authorDerek Allard <derek.allard@ellislab.com>2008-04-06 21:58:20 +0200
committerDerek Allard <derek.allard@ellislab.com>2008-04-06 21:58:20 +0200
commit16629b1cef61db05646839d6789d98ddc5aaf16b (patch)
tree0dcf40090cdd96e5815bf489f19e86639fd38668 /user_guide/database
parent96863ce12d88b2126b80bf1b00a73eed1ad6be86 (diff)
Fixed a bug that wasn't allowing escaping to be turned off if the value of a query was NULL.
Diffstat (limited to 'user_guide/database')
-rw-r--r--user_guide/database/active_record.html32
1 files changed, 10 insertions, 22 deletions
diff --git a/user_guide/database/active_record.html b/user_guide/database/active_record.html
index a9889d559..5fbd3bc8e 100644
--- a/user_guide/database/active_record.html
+++ b/user_guide/database/active_record.html
@@ -219,8 +219,7 @@ $this->db->join('comments', 'comments.id = blogs.id', <strong>'left'</strong>);<
<li><strong>Simple key/value method:</strong>
<code>$this->db->where('name', $name);
- <br /><br />// Produces: WHERE name = 'Joe'
- </code>
+ <br /><br />// Produces: WHERE name = 'Joe' </code>
<p>Notice that the equal sign is added for you.</p>
@@ -229,11 +228,7 @@ $this->db->join('comments', 'comments.id = blogs.id', <strong>'left'</strong>);<
<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>
+ <br /><br />// WHERE = name 'Joe' AND title = 'boss' AND status = 'active' </code> </li>
<li><strong>Custom key/value method:</strong>
@@ -241,12 +236,7 @@ $this->db->join('comments', 'comments.id = blogs.id', <strong>'left'</strong>);<
<code>$this->db->where('name !=', $name);<br />
$this->db->where('id <', $id);
- <br /><br />// Produces: WHERE name != 'Joe' AND id < 45
- </code>
-
-
-
- </li>
+ <br /><br />// Produces: WHERE name != 'Joe' AND id < 45 </code> </li>
<li><strong>Associative array method:</strong>
@@ -254,29 +244,27 @@ $this->db->join('comments', 'comments.id = blogs.id', <strong>'left'</strong>);<
$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>
+ <br /><br />// Produces: WHERE name = 'Joe' AND title = 'boss' AND status = 'active' </code>
<p>You can include your own operators using this method as well:</p>
<code>
$array = array('name !=' => $name, 'id <' => $id, 'date >' => $date);<br /><br />
- $this->db->where($array);</code>
-
- </li>
+ $this->db->where($array);</code> </li>
<li><strong>Custom string:</strong>
<p>You can write your own clauses manually:</p>
<code>
$where = "name='Joe' AND status='boss' OR status='active'";<br /><br />
- $this->db->where($where);</code>
-
- </li>
-</ol>
+ $this->db->where($where);</code></li>
+ </ol>
+<p>$this-&gt;db-&gt;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-&gt;db-&gt;where('MATCH (field) AGAINST (&quot;value&quot;)', 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>