PHP/MySQL warning

I have the following code which is giving me a warning when it runs

  $sql = "SELECT * FROM keyareas ORDER BY seq_no";
  $keyareas = @mysql_query($sql);
  if (!$keyareas) {
    echo '<p class="error">Error retrieving data!<br />Error: '.mysql_error().'</p>'; 
    exit(); 
  } 
  while ($keyarea = mysql_fetch_array($keyareas)) {
    $keyarea = $keyarea["keyarea"];
    $fieldid = "keyarea-".str_replace(" ", "_", $keyarea);
    echo '<label for="'.$fieldid.'"><input type="checkbox" name="'.$fieldid.'" id="'.$fieldid.'"'; 
    if (strstr($keyareas, $keyarea)) echo ' checked="checked"';
    echo ' /> '.$keyarea.'</label>'."\
";
  }

The warning is strstr() expects parameter 1 to be string, resource given. I have similar code for several other tables within the same script which are not giving error messages. Not sure what I’m missing…

Ah, grazie, Guido. I see the error of my ways. It should have been $akeyareas.

Again, many thanks

$keyareas is the mysql result set. I’m sure you are using something else for the other tables. If you post one of those similar pieces of code, we should be able to tell you the difference.