Re: HUGE problem here
| From: | Camelia Enderby | Date: | Sat, 08 Jun 2002 09:13:25 +0000 |
| Subject: | Re: HUGE problem here | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-19684@lists.php.net to get a copy of this message | ||
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" <caracena@infovia.com.ar>
To: "PHP DB List" <php-db@lists.php.net>
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:webmaster@icaam.com.ar> Aracena
CE / MCSE+I
Neuquen, Argentina
+54.299.6356688
+54.299.4466621