Will this PHP isUnique function work?
<p>It has been a while since I have programmed PHP so I am very rusty, so I just want to double check my work. With the following code work as a way to check if the string is unique against a database?</p>

<pre><code>        function isUnique($string, $type) {
        switch ($type) {
            case 'username':
                $query = $this-&gt;db-&gt;select('username')
                    -&gt;from('olm_user')
                    -&gt;where('username', $string);
                if (!$query-&gt;num_rows()) {
                    return false; // returns false if not taken?
                }
                break;
            case 'email':
                $query = $this-&gt;db-&gt;select('email')
                    -&gt;from('olm_user')
                    -&gt;where('email', $string);
                if (!$query-&gt;num_rows()) {
                    return false; // returns false if not taken?
                }
                break;
            case 'olname':
                $query = $this-&gt;db-&gt;select('olname')
                    -&gt;from('olm_user')
                    -&gt;where('olname', $string);
                if (!$query-&gt;num_rows()) {
                    return false; // returns false if not taken?
                }
                break;
        }
    }
</code></pre>
