try this for the delete query:
$query = "DELETE FROM auth WHERE name='$deletename'";
See if it helps.

Cami

----- Original Message -----
From: "CÚsar L. Aracena" <[EMAIL PROTECTED]>
To: "PHP DB List" <[EMAIL PROTECTED]>
Sent: Saturday, June 08, 2002 10:03 AM
Subject: [PHP-DB] HUGE problem here


Hi all,

I have a deadline for tomorrow morning (4 more hours) and have one small
problem I've been working on for 3 hours now. I want the Administrators
of a site to be able to delete or create new Admin users from within one
admin's page.

>From the "Aministrators page" they will see a list of available
administrators with a "DELETE" link aside each one. This works just
fine, and the link I made looks like this:

[snip]
echo "<a
href=\"manageusers.php?mode=deleteuser&deletename=$row[name]\">DELETE
USER</a>";
[snip]

I also made a FORM to insert new ADMINS from the same page which
displays the list of ADMINS which looks like this:

[snip]
<FORM ACTION="manageusers.php?mode=adduser" METHOD=POST>
            <P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=5 WIDTH="100%">
               <TR>
                  <TD>
                     <P><INPUT TYPE=text NAME=newuser VALUE="USER"
SIZE=20 MAXLENGTH=10></P>
                  </TD>
                                                 <TD>
                     <P><INPUT TYPE=text NAME=newpass VALUE="PASSWORD"
SIZE=20 MAXLENGTH=30></P>
                  </TD>
                  <TD>
                     <P><INPUT TYPE=submit NAME=Submit VALUE="ADD
ADMIN"></P>
                  </TD>
               </TR>
            </TABLE>

         </FORM>
[snip]

When the page manageusers.php is called, it looks like this:

[snip]
<?
              if ($mode)
              {
                        if ($mode == 'deleteuser')
                        {
                                    $query = "DELETE FROM auth WHERE
name=$deletename LIMIT 1";
                                   $result = mysql_query($query);

                                   if ($result);
                                   {
                                               echo "User deleted";
                                   }
                        }
                        else if ($mode == 'adduser')
                        {
                                    $query = "INSERT INTO auth VALUES ('
".$newuser." ', password(' ".$newpass." '))";
                                   $result = mysql_query($query);

                                   if ($result)
                                   {
                                               echo User Added";
                                   }
                        }
              }
?>
[snip]

It works just fine for adding new ADMINS but when I want to delete one,
despite the fact it does tell me that it was deleted, the ADMIN is still
there. What the heck is going on???

Thanks so much in advance. did I mentioned I have to get it fized in 4
hours ;-) ???

Cesar <mailto:[EMAIL PROTECTED]>  Aracena
CE / MCSE+I
Neuquen, Argentina
+54.299.6356688
+54.299.4466621




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to