Unknown column 'id' in 'where clause'
<p>Any idea why i might be getting this error when submitting to a DB?</p>

<p>Unknown column 'id' in 'where clause'
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/somebody/public_html/sendmessage.php on line 41</p>

<pre><code>while($success == FALSE) { 
$rand = rand(100000, 999999); 

$q = "SELECT * FROM $tablename WHERE id = '$rand'"; 
$r = mysql_query($q, $link);

echo mysql_error();


if(mysql_num_rows($r)) { **THIS IS LINE 41** 
    continue; 
} else { 
    $success = TRUE; 
} 
} 
</code></pre>
