> 
> **Possible Duplicate:**  
> 
> [Warning: mysql\_fetch\_array(): supplied argument is not a valid MySQL result](https://stackoverflow.com/questions/795746/warning-mysql-fetch-array-supplied-argument-is-not-a-valid-mysql-result) 
> 
> 
> 

i have an error being drawn with this code:

```
<?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' => $r['p_id'], 'name' => $r['p_title']);
    }
    print json_encode($projects);
    exit;

?>

```

I get this error:

> 
> **Warning**: mysql\_fetch\_assoc(): supplied argument is not a valid MySQL result resource in **/home/content/g/a/t/gatts316/html/clients/inc/get-projects.php** on line **10**  
> 
> 
> 
> []
> 
> 
>