I have a small piece of code that is failing and have no idea why ..
function delete($User){
$query = "delete from test where name='{$User}'";
echo "<BR>$query<BR>";
mysql_query($query) or die ('Query failed');
}
I get query failed every time I run it. The same script has functions for querying and adding data and they work fine. the user has delete privileges on the table.
I am a UNIX administrator trying to put together a website for system and password management. Is there anything already out there that I can use quickly? I am quite comfortable with shell scripting, but php is a little out of my domain. I don't want to re-invent the wheel here ....
Thanks,
Red
Newbie question : delete via php fails
Moderator: General Moderators
-
redmosquito
- Forum Newbie
- Posts: 2
- Joined: Sat Mar 10, 2007 9:05 pm
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Try this instead
And please use tags in the future.
Code: Select all
function delete($User){
$query = "delete from test where name='{$User}'";
echo "<BR>$query<BR>";
mysql_query($query) or die (mysql_error());
}Code: Select all
-
redmosquito
- Forum Newbie
- Posts: 2
- Joined: Sat Mar 10, 2007 9:05 pm
after any changes to mysql privileges you need to issue the following
Code: Select all
mysql>flush privileges;