[thelist] MySql - checking two tables at once.
Adrian Fischer
adrian at logo-logic.com
Sun Jan 6 00:56:12 CST 2002
Yet again I come with cap in hand...
I have to two tables (tblAdvise and tblEmails) each of which have got email
addresses in them. Each table serves a seperate function. When someone
unsubscribes I need to be able to search both the tables for the email
address to see if its one that actually exists and if it does delete it from
the table.
I know how to do each to do each of the tasks seperately but would like to
be able to do something like this:
<snip>
my $db = &dbconnect;
&death("We don\'t seem to have anyone subscribed with that Email
Address!<BR>Have you typed it correctly?<BR>($form{'EMAIL'})") unless
$db->selectrow_array("SELECT Email FROM tblAdvise tblEmails WHERE
Email='".sqlEncode($form{'EMAIL'}) ."' ");
$dbh=$db->do("DELETE FROM tblAdvise tblEmails WHERE
Email='".sqlEncode($form{'EMAIL'}) ."' ");
&dbdisconnect($db);
</snip>
but I cant get it to work. I'm pretty sure the &death bit is working
because I can actually get past taht point. but it doesnt delete the email.
If I do it for just the tblAdvise it works fine.
Your help would be appreciated.
Regards
Adrian Fischer
More information about the thelist
mailing list