Hello,
I have a perl script that connect to a mysql database.
Sometimes a query does not return any row. In the case if there is no rows, how can I print a message like "no row prensent" ?
(how can I insert a if condition that check the rows returned in the while loop ?)
Thanks
I have a perl script that connect to a mysql database.
Sometimes a query does not return any row. In the case if there is no rows, how can I print a message like "no row prensent" ?
(how can I insert a if condition that check the rows returned in the while loop ?)
Thanks
Code:
$retocaisse_sql = $dbh->prepare("select DATE_FORMAT(eventtimestamp, '%d%m%y'), count(*)
from msc
where receiverid=$idcaisse
and statustypid=200
and DATE_FORMAT(eventtimestamp, '%d%m%y') BETWEEN @datelistingV2 and $datejourbrut
group by DATE_FORMAT(eventtimestamp, '%d%m%y') ");
$retocaisse_sql->execute;
print "\nRetours reçus";
while( ($date_retour, $retocaisse) =$retocaisse_sql->fetchrow() ) {
print "Date: $date_retour Retours reçus: $retocaisse \n";