First off, this assumes you are using DBI in your perl script.
The line of code you want is this:
my $rows = $sth->rows;
This will run after the execute statement of a SQL query.
$rows will contain how many rows were affected or it will return -1 if there
was a problem (returned undef, error, etc...).
For more help see perldoc DBI
Pete Hanson
source1results.com
-----Original Message-----
From: Daniel Falkenberg [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 17, 2001 6:00 PM
To: [EMAIL PROTECTED]
Subject: Truth and SQL
Hi list,
Basically I want to be able to do an SQL query and if the query returns no
results I want my script to say Ok your query rerurned 0 results print this
message... "Sorry your seach returned no messages".
What is my best way of going about this? Would it work similar to this...
Do search ....
if (!$sql_search) {
print "Sorry your result returned no matches"';
else {
print "here are the results";
$sql_search;
}
}
Any suggestions will help imensly,
Regards,
df
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]