I'm running a CGI script that uses Perl DBI to check for records in an access database. I'd like the users to get a message if their search doesn't have any matches, but I can't find a way to get it to work. The criteria are entered via html form, then used to build a SQL statement that searches through the ODBC to the access DB. Pretty simple stuff -- the problem is that I have a
statement in there for getting results. I tried running comparisons on the contents of @row, but since no results in the DB causes a failure in the while loop, that's no good. I've tried putting the assignment into an if statement, but then if it succeeds, I lose the first match from the search.
All I want is a way to check whether the SQL statement got any results from the database, and display a quick note if not. I'm thinking there's got to be a simple way to do it, but I haven't stumbled my way into it yet.