That error message is telling you that you can't fetch something from $sth because it didn't execute properly. What that means is that the trouble actually started earlier, and probably surfaced somewhere in either of these lines:
$sth = $dbh->prepare ($stmt);
$sth->execute();
On the face of it I can't see anything wrong with your code (though other monks may be able to). My guess is something like a typo in $stmt. The easy way to find out is to edit those lines to
$sth = $dbh->prepare ($stmt) or die $dbh->errstr;
$sth->execute() or die $dbh->errstr;
That may well throw some light on exactly where it's breaking down, by giving you some informative error messages. (NB if it dies on the first of these and doesn't give you an informative error message, that probably means your DB handle didn't get properly initialised in the first place - password prob?)
§ George Sherston
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|