in reply to Re: small cgi output problem
in thread small cgi output problem

Of course, I guess the question here is, how do you know if there were no rows returned... without causing an error... or should you just try to catch the error.
                - Ant

Replies are listed 'Best First'.
Re: Re: Re: small cgi output problem
by chromatic (Archbishop) on Apr 09, 2001 at 21:00 UTC
    Pragmatically speaking, if there are no rows returned, the fetch*() call won't loop very many times. (Assuming 'zero' is akin to 'not very many').

    The practical approach would be to issue a SELECT COUNT(*) query, which makes the database do the counting.

      whats the correct syntax in perl for that selection with regard to the $sth5 selection step

        What chromatic is saying is that if you want to see the number of rows a query will return, a good way is to issue an explicit SELECT COUNT(*) FROM tablename WHERE field_value = whatever and get the return value BEFORE you issue the SELECT to get the value.

        Philosophy can be made out of anything. Or less -- Jerry A. Fodor

      With the MySQL DBI it will allow you to call fetchrow forever if nothing is returned. Throwing errors.
                      - Ant