PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
xQuasar
Forum Newbie
Posts: 19 Joined: Tue Dec 02, 2008 5:53 pm
Post
by xQuasar » Thu Dec 25, 2008 3:21 pm
How do you do it via PHP? I've tried, but the following methods don't work and I'm out of ideas...
Code: Select all
$saltQuery = "UPDATE accounts set salt=NULL where name = '$tusername'";
Code: Select all
$saltQuery = "UPDATE accounts set salt=(NULL) where name = '$tusername'";
Both don't work
Well, with PHP anyways.
In MySQL Query Browser,
UPDATE `accounts` set `salt`=NULL where `name` = 'name';
WORKS.
aditya2071990
Forum Contributor
Posts: 106 Joined: Thu May 22, 2008 11:30 am
Location: Hyderabad, India
Contact:
Post
by aditya2071990 » Thu Dec 25, 2008 3:30 pm
Did you try:
Code: Select all
$saltQuery = "UPDATE accounts set salt='' where name = '$tusername'";
This will work if in the database, the salt field is not set to "not_null", and if the default value is null...
xQuasar
Forum Newbie
Posts: 19 Joined: Tue Dec 02, 2008 5:53 pm
Post
by xQuasar » Thu Dec 25, 2008 3:34 pm
`salt` varchar(32) default NULL
^ That's the column. And I've tried it, it doesn't work with what I'm trying to do.
aditya2071990
Forum Contributor
Posts: 106 Joined: Thu May 22, 2008 11:30 am
Location: Hyderabad, India
Contact:
Post
by aditya2071990 » Thu Dec 25, 2008 3:39 pm
Are salt and name the only two fields in the table? If they are not, try and omit that from the sql command at all, and fill some other field with some data, then automatically, salt gets a value Null
Code: Select all
$saltQuery = "UPDATE accounts set someOtherField='someOtherValue' where name = '$tusername'";