Oh. Weedhopper will try again, Master. :}) >From the fine manual (perldoc DBI):
==== fetchrow_array @ary = $sth->fetchrow_array; An alternative to fetchrow_arrayref. Fetches the next row of data and returns it as a list containing the field values. Null fields are returned as undef values in the list. If there are no more rows or if an error occurs, then fetchrow_array returns an empty list. You should check $sth->err afterwards (or use the RaiseError attribute) to discover if the empty list returned was due to an error. ==== You already have RaiseError set, so an empty array means no data. -- 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: "Tim Bunce" <[EMAIL PROTECTED]> To: "Michael A Chase" <[EMAIL PROTECTED]> Cc: "Craig Sharp" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Thursday, January 31, 2002 14:16 Subject: Re: Not found subroutine > Er, reread the question :) > > Tim. > > On Thu, Jan 31, 2002 at 12:47:56PM -0800, Michael A Chase wrote: > > 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.
