Before I delete something from the database, I need to make sure that there 
is only one entry, and not multiple ones.  I can't do this via the database 
itself, because of the need for multiple entries that bear different names, 
but the same primary key (which I have since removed).  I can't add names 
as a part of the primary key-- they're used often because someone will 
order multiple necessities on the same days and with the same order 
number.  Here's the problem.... since I'm forced into doing this in code, 
how do I make a nested if that works or is it even possible???

This is the code that I have so far (please note, it is within a 
function)... any ideas of how I can make it work?

$not_del = "SELECT FROM Orders WHERE req like '" . $GLOBALS["old_req"] . "' 
AND source like '" . $GLOBALS["old_src"] . "' AND number = " . 
$GLOBALS["old_num"];
$del = "DELETE FROM Orders WHERE req like '" . $GLOBALS["old_req"] . "' AND 
source like '" . $GLOBALS["old_src"] . "' AND number = " . $GLOBALS["old_num"];


   if (mysql_num_rows($not_del) != 1) {
     $message .= "Multiple entries.  Delete NOT allowed.";
   } elseif (mysql_num_rows($not_del) == 1) {
     if (mysql_query($del)) {
       $message .= "Remove OK.";
     } else {
       $message .= "Remove NOT.";
     }
   }
   return urlencode($message);

Thanks,

Liz


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to