Jump to content


Photo

Updating Field to Null


  • Please log in to reply
2 replies to this topic

#1 gusty

gusty
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 24 April 2006 - 12:58 PM

Hi,

I'm trying to change a field in my sql table back to NULL. (default). It's if the user enters info to the wrong row and wants to change back to NULL. The code I use changes the field to 0 when executed. I've searched for this here and online and I'm not sure what's happening. I could use 0 but curious to what's happening. Here's my code.

$delSQL = sprintf("UPDATE table SET field1='NULL' WHERE field2=%s",
GetSQLValueString($vr, "text"));

I would appreciate any pointers you can give me.
Thanks,
Gusty.

#2 wisewood

wisewood
  • Members
  • PipPipPip
  • Advanced Member
  • 226 posts
  • LocationRotherham, England

Posted 24 April 2006 - 01:08 PM

is the field that you're trying to reset to "NULL" a numeric field such as an integer? If it expects an integer, and you tell it to use NULL, it will use 0 instead.
wisewood: proven fact, I am both wise, and wooden.

#3 gusty

gusty
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 24 April 2006 - 01:58 PM

That's it. Thanks man.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users