php quoting problem
<p>I have this PHP code</p>

<pre><code>echo '&lt;a href="#" onclick="updateByQuery(\'Layer3\', ' . json_encode($query) . ');"&gt;Link 1&lt;/a&gt;';
</code></pre>

<p>which generates a link like this:</p>

<pre><code>&lt;a href="#" onclick="updateByQuery('Layer3', "Ed Hardy");"&gt;Link 1&lt;/a&gt;&lt;li&gt;Link 2&lt;/li&gt;
</code></pre>

<p>Causing the javascript to not be called. How would I make it generate single quotes around the result of $query, in this case ed hardy?</p>
