PDA

View Full Version : how to make a cell a default NULL again?


Jilli
08-03-2009, 10:36 PM
hi guys

i have a bit of a problem here, i want to make a script and part of it is able to make a cell back to a default NULL value..

how is this done? i been trying for ages with no luck and for once, google isnt much help :(

here is the syntax i had the most faith in:

$querynull1 = "UPDATE chars SET s" . $inskill . "= NULL WHERE id=$id";

ty in advance
Jilli

MattF
08-03-2009, 10:44 PM
Try enclosing NULL within single quotes, i.e: 'NULL'.

ckeyrouz
08-03-2009, 11:40 PM
I don't think that the solution provided by MattF is accurate because you will be saving the value null as a string 'null'.


Your query seems to be correct.
Can you post the error thrown by mysql?

MattF
08-04-2009, 12:13 AM
I don't think that the solution provided by MattF is accurate because you will be saving the value null as a string 'null'.

Yup. My mistake.

Old Pedant
08-04-2009, 02:07 AM
Have you tried DEBUG???

In particular, maybe:

$querynull1 = "UPDATE chars SET s" . $inskill . "= NULL WHERE id=$id";
echo "DEBUG SQL: " + $querynull1 + "<hr>\n";
...

See if you are indeed getting the right values for $inskill and $id.

Oh...and do you get an error from that??? Or it simply doesn't work?