I have a perl script that selects users dial-up usage based on month/year -
It works fine, but if the selected month/year does not contain any usage
data, the only way I can check is with the following code:
# $sth->execute() # Execute the query
$my_result = $sth->execute() # Execute the query
or die "Couldn't execute statement: " . $sth->errstr;
if ($my_result eq "0E0"){
print "No data is available for the selected time period";
exit(0);
}
# The select produced results - Read the matching records and
print them out
while (@data = $sth->fetchrow_array()) {
The '0E0' came about by just printing the result of $my_result during
successful/non-successful selects.
I'm sure there is a more elegant way to check if a select statement results
in success or not.
Regards,
Michael
Debian Linux 2.2, mysql Ver 9.38 Distrib 3.22.32, for pc-linux-gnu (i686)
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php