Checking to see if a call to the DB worked
From: Stymiee (stymiee_at_hotmail.com)
Date: 11/29/03
- Next message: Gunnar Hjalmarsson: "Re: CGI error (need help)"
- Previous message: Bernard: "Re: CGI error (need help)"
- Next in thread: Nick Santos: "Re: Checking to see if a call to the DB worked"
- Reply: Nick Santos: "Re: Checking to see if a call to the DB worked"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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?
- Next message: Gunnar Hjalmarsson: "Re: CGI error (need help)"
- Previous message: Bernard: "Re: CGI error (need help)"
- Next in thread: Nick Santos: "Re: Checking to see if a call to the DB worked"
- Reply: Nick Santos: "Re: Checking to see if a call to the DB worked"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|