Checking to see if a call to the DB worked

From: Stymiee (stymiee_at_hotmail.com)
Date: 11/29/03


Date: Sat, 29 Nov 2003 14:11:06 -0600

I'm writing a perl script to send out a joke of the day for my website.
It is accessing a mysql db (I use php for the rest of the site. This will
be a cron job so I figured perl would be better suited for that). I can
get it to do everything it is supposed to do to send a the joke via
email. But what I'm trying to do now is add some error checking so if
there is a problem, I can be notified about it.

What I need is to know how to check if a query was succcessful or not.
For example:

Code:

sub changeCurrentJOTD(){
    $dbh = DBI->connect("DBI:mysql:database=$serverDb;host=
$serverName;port=$serverPort",$serverUser,$serverPass);
    $dbh->do("UPDATE jokes_content_test SET jotd='Yes' WHERE
jotd='today'");
    $dbh->disconnect;
}

How do I check to see programatically if this was successful or not?



Relevant Pages

  • Fetch failed. Error while describe result set
    ... I have a testing host (local with XP, apache, php, perl) and I am ... trying to write a perl script to get some records from a mysql DB. ...
    (perl.dbi.users)
  • Calling Perl module from C coredumps on connection to MySQL database
    ... I've written a C program that calls a perl script. ... and the perl script needs to connect to the MySQL database. ... The MySql version is 5.0.22-Debian_0ubuntu6.06.2. ... fprintf (stderr, "BM: MySQL Error - Can't init MySQL ...
    (perl.dbi.users)
  • Re: PHP in a Perl Script
    ... > except that the perl script also writes out some PHP processing. ... I assume this is on Apache ... ...
    (comp.lang.perl.misc)
  • Re: [PHP] variables from perl cgi into a php
    ... that wrote the perl script is unavailable to work it in the perl script due ... mysql database. ... Sounds like you want your Perl application to call a bit of PHP and pass PHP ... Then the PHP script can grab the URL variables and save them in the ...
    (php.general)
  • RE: [PHP] Images being uploaded in ASCII format
    ... I'll look forward to the perl script to see if it sheds any more light ... Images being uploaded in ASCII format ... Unfortunately PHP does not allow access to raw POST ... Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. ...
    (php.general)