If I'm interpreting the code correctly, then you're polling the resultset
for the number of rows it has, not the actual returned value. The number of rows will always be 1, since a
count
query always returns one result. In other words, you're looking at the number of results, not the result itself. At least, that's what it looks like :)
Code in question:
printf("Legal: %d\n", mysql_num_rows(result));