RE: [PHP-DB] HUGE problem here
| From: | Peter Lovatt | Date: | Sat, 08 Jun 2002 09:14:16 +0000 |
| Subject: | RE: [PHP-DB] HUGE problem here | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-19685@lists.php.net to get a copy of this message | ||
"DELETE FROM auth WHERE name=$deletename LIMIT 1";
needs quotes
"DELETE FROM auth WHERE name='$deletename' LIMIT 1";
This may be the problem.
HTH
Peter
-----------------------------------------------
Excellence in internet and open source software
-----------------------------------------------
Sunmaia
www.sunmaia.net
info@sunmaia.net
tel. 0121-242-1473
-----------------------------------------------
> -----Original Message-----
> From: César L. Aracena [mailto:caracena@infovia.com.ar]
> Sent: 08 June 2002 10:04
> To: PHP DB List
> Subject: [PHP-DB] HUGE problem here
> Importance: High
>
>
> Hi all,
>
> I have a deadline for tomorrow morning (4 more hours) and have one small
> problem Ive 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
> admins 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
>
>