in reply to MySQL and PERL tribulations....
In addition to the other suggestions here, you might wrap your DBI calls in an eval {} block, check for errors and then print out a helpful message to the browser if a message is found. Also, you should print out your http header before you do anything else to make this possible.
# I assume that this routine prints out the http header &header("We are done"); $query = "SELECT nw_ucountry FROM $Table"; $query .= " WHERE nw_ucountry LIKE '$country'"; my ($sth); eval { $sth = $dbh->prepare($query); $sth->execute; }; if ( $@ ) { print "<p>Error found executing SQL.\n", "<pre>$query\nError: $@</pre>"; } else { while (($qcountry) = $sth->fetchrow_array()) { ... } }
It also helps greatly if you can keep an eye on your web server's error logs. Messages output from a die (either explicitly or implicitly using the RaiseError attribute) should appear there and would be much more helpful than the message that appears to the browser.
Chris
M-x auto-bs-mode
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: RE: MySQL and PERL tribulations....
by bman (Sexton) on Nov 10, 2000 at 02:20 UTC |