0

I'm having problems updating records to contain NULL values - in particular, a field which is of type Date.

I'm using prepared statements and I've tried the following:

// Fails
$value = NULL;

// Fails
$value = "";

// Fails
$value = "NULL";

all 3 of the above result in a date of 1969-12-31 being entered (0). How do I insert NULL values?

3
  • What does the definition for your table look like? May you insert a NULL value into this field? Commented Mar 10, 2010 at 18:42
  • Yes, it allows null values. If I go into PHP my admin I can do "update tblA set date_field = NULL" sucessfully, or without prepared statements it works fine. Commented Mar 10, 2010 at 18:43
  • 2
    you're talking about sql here, so could you please show the query you're using to update the row? Commented Mar 10, 2010 at 18:43

1 Answer 1

1

Did you read the following question/answer: using nulls in a mysqli prepared statement

That seems to be the same issue. Correct me if I'm wrong?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.