Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource
<p>I've written dozens of functions before, but this one is giving me an error which I just can't figure out: </p>

<blockquote>
  <p>Warning: mysql_fetch_array(): supplied argument is not a valid MySQL
  result resource in /home/XXXXXXX/public_html/new/includes/data.php on
  line 298</p>
</blockquote>

<p>It's a generic function so that I can retrieve data from a specific cell.</p>

<pre><code>function getName($column, $table, $where, $id) {
   $res = mysql_query("SELECT $column as cname FROM $table WHERE $where='$id'");
   $row = mysql_fetch_array($res);
   return $row['cname'];
}
</code></pre>
