This is a semantics question, not a syntax question. It has nothing to do with how the C program works. The only this the C program does is generate the output.
The user fills out a search form, the search executes displaying the first 50 results. Can you do a count on the total records in the same query as only selecting the first 50? Or can I do another type of query that will return the total number along with the results????
Or, could I submit the form to a php script, get the total number, if it's more than 50 display a message saying their search produced more than 50 results, click oK to continue, and then execute the c program to display the results, else if it's less than 50 just execute the script?