Either turn off RaiseError for the SELECT prepare - execute and check for
$DBI::err after each or put and eval block around the bunch ( eval {
statements } ) and test for $@ after it. I think I'd prefer the second.
--
Mac :})
** I normally forward private questions to the appropriate mail list. **
Ask Smarter: http://www.tuxedo.org/~esr/faqs/smart-questions.htm
Give a hobbit a fish and he eats fish for a day.
Give a hobbit a ring and he eats fish for an age.
----- Original Message -----
From: "Craig Sharp" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 31, 2002 12:19
Subject: Not found subroutine
I need to be able to determine if a value is not found within a database and
if so, report that the data and or row is not available back to the browser.
Here is my script that I am using to retrieve the data:
>>>>>> SNIP >>>>>>>>>
$dbh = DBI->connect("DBI:Informix:domain",
{
RaiseError => 1,
AutoCommit => 0
}
);
$sth = $dbh->prepare("update reg_info set active = ? where domain_name =
?");
$sth->bind_param( 1, $postInputs{'active'} );
$sth->bind_param( 2, $postInputs{'domain_name'} );
$sth->execute();
$sth = $dbh->prepare("select * from reg_info where domain_name = ? and
active = ?");
$sth->bind_param( 1, $postInputs{'domain_name'} );
$sth->bind_param( 2, $postInputs{'active'} );
$sth->execute();
@row=$sth->fetchrow_array();
print "<h3><center>You have successfully updated the following
information!</center></h3>";
print "<center>Domain Name: $row[0]</center>";
print "<center>Active: $row[5]</center>";
print "</body></html>";
print " ";
>>>>>> SNIP >>>>>>>>>
If the update statement cannot run due to the domain_name not existing in
the database I need to send an error back to the browser. A similar thing
would be if the user was searching for a domain such as:
select * from reg_info where domain_name = "mydomain.com"
and the domain cannot be found in the table.