Page 1 of 1

Updating with an empty value?

Posted: Thu Aug 07, 2003 2:27 pm
by Sephiriz
I have a certain script that (well, it should, but it doesn't) deletes certain items in a row from someones mysql database. If that made no sense, I'll try to make an image.

id|user|password|stuff|.....stuff2 |
1.some...w/e........junk...more junk


I want to delete only the part with more junk in it. This field is a text field, and I tried updating the table by going :
("UPDATE users SET stuff2='' WHERE username='$username'");

The script isn't working though >.< Is this the wrong way to go about emptying a field?

Posted: Thu Aug 07, 2003 3:06 pm
by McGruff
The mysql query string is in the correct form.

However, the table structure you gave has a "user" column but your mysql query refers to "username".

Another possible source of the problem could be that the $username var isn't declared (or is declared but not in the same scope as the mysql query string).

Setting php error reporting to E_ALL identifies undeclared variables - should always develop scripts with E_ALL.