# PHP: determine is MySQL result is empty set?



## michaelsanford (Jan 22, 2003)

I know this is basic but I'm having problems determining if my MySQL result set is the Empty Set.

YT = Yukon. I have a separate (I know it's inefficient, but I don't particularly mind this time) SELECT for each province. In the query strings that have values it prints the lists just fine, they don't have this if clause, just the print command.

If there is an empty set, it prints a blank row in a table (i.e., a row with height of 0. We want to make it print a string when there are no results for that province).

Here's an example snippit, with the table formatting tags removed:


```
$resultID = mysql_query($queryStringYT, $linkID);
while(list($groupID, $groupName) = mysql_fetch_row($resultID))
 {
  if ($groupID == "") then print "empty";
  else print "$groupID, $groupName";
 }
```

I've also tried


```
$resultID = mysql_query($queryStringYT, $linkID);
while(list($groupID, $groupName) = mysql_fetch_row($resultID))
 {
  if (mysql_field_len($resultID, 'groupID') == 0) print "nope";
  else print "$groupID, $groupName";
 }
```

I've experimented with COUNT but couldn't get it figured out.

This is really bugging me


----------

