Syntax error with nested replace statements
<p>I am getting a syntax error with the follow code snippet:</p>

<pre><code>    $handle = $table.'_'.$field;
    if($queryType=='replace') {
        $sql[$handle]['sql'] = 'UPDATE '.$table.' SET '.$field.' = replace(replace(replace('.$field.',\''0', ''), '1', ''), '2', '')';
    } else {
        $sql[$handle]['sql'] = 'SELECT * FROM '.$table.' WHERE '.$field.' REGEXP(\''.$search.'\')';
    }
</code></pre>

<p>I am sure I have just forgot something small but I cant seem to find out what is causing the error.</p>

<p>Any help would be much appreciated.</p>
