The Daily Static
  The Daily Static
UF Archives
Register
UF Membership
Ad Free Site
Postcards
Community

Geekfinder
UFie Gear
Advertise on UF

Forum Rules
& FAQ


Username

Password


Create a New Account

 
 

Back to UserFriendly Strip Comments Index

MySQL question by Nawft 2002-07-23 00:04:48
My book is very vague on how to do error checking with MySQL and Perl. The code I use to delete records and check for errors and catches things like invalid table name and such. But it doesn't seem to catch if I try to delete something that does not exist. Should it? and if so how?

I am currently deleting MySQL table rows like this:

#This attempts to delete the banner ad from the anners db
my $rows_affected = $temp_dbh->do("delete from anners whereb anner_id = \"$temp_bid\"");

#If was successful the banner has been deleted
if ($rows_affected)
{
return 1;
}else{
my $errmsg = $temp_dbh->errstr;
print '<div class="err">Error: ' . "$errmsg" . '</div>' . "\n";
return 0;
}
[ Reply ]
  Well... by Dongorath2002-07-23 00:10:29
    actually by Nawft2002-07-23 00:13:06
  Its not an error. by aix tom2002-07-23 00:16:07
    Thank you very much by Nawft2002-07-23 00:19:11
      When you think about it, it *is* successful... by fore_deck2002-07-23 01:18:18
        Thats smart :) by caffine-iv2002-07-23 01:22:48

 

[Todays Cartoon Discussion] [News Index]

Come get yer ARS (Account Registration System) Source Code here!
All images, characters, content and text are copyrighted and trademarks of J.D. Frazer except where other ownership applies. Don't do bad things, we have lawyers.
UserFriendly.Org and its operators are not liable for comments or content posted by its visitors, and will cheerfully assist the lawful authorities in hunting down script-kiddies, spammers and other net scum. And if you're really bad, we'll call your mom. (We're not kidding, we've done it before.)