mysql_assoc error - displaying fine
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/795746/warning-mysql-fetch-array-supplied-argument-is-not-a-valid-mysql-result">Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result</a>  </p>
</blockquote>



<p>i have an error being drawn with this code:</p>

<pre><code>&lt;?php
    include "config.inc.php";
        mysql_query($addClient) or die(mysql_error());
    $sth = mysql_query(
        sprintf(
            "SELECT c_id,p_id,p_title FROM projects WHERE c_id = %s",
            mysql_real_escape_string($_GET['id'])
        )
    );
    $projects = array();
    while($r = mysql_fetch_array($sth)) {
        $projects[] = array('id' =&gt; $r['p_id'], 'name' =&gt; $r['p_title']);
    }
    print json_encode($projects);
    exit;


?&gt;
</code></pre>

<p>I get this error:</p>

<blockquote>
  <p><b>Warning</b>:  mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in <b>/home/content/g/a/t/gatts316/html/clients/inc/get-projects.php</b> on line <b>10</b><br /></p>
  
  <p>[]</p>
</blockquote>
