Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6149309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:25:51+00:00 2026-05-23T19:25:51+00:00

I have updated certain field in my database & that field has default value

  • 0

I have updated certain field in my database & that field has default value as NULL. How can I again fill NULL if field is emptied or deleted. As during this updation blank value is filled in database and of course that is not NULL. Is filling NULL instead of blank value good?

Using php how can I do that? Suppose I have condition if code

if(!empty($photo))
{ $a in database;
}

But in this condition if $photo is empty it will fill blank value of $a… Let me know to fill NULL in database.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T19:25:52+00:00Added an answer on May 23, 2026 at 7:25 pm

    You just have to write null, and not an empty value, to your database.

    You SQL query would look like this :

    update your_table
    set your_field = NULL
    where ...
    

    instead of :

    update your_table
    set your_field = ''
    where ...
    

    To switch between those two queries, you might need some condition in your PHP code, depending on how it’s organized ; maybe like this :

    if (empty($photo)) {
        // query to set the field to NULL
    }
    else {
        // query to update the value
    }
    

    Note that if you have no value to store for a row in your database, you might also want to just delete that row :

    delete from your_table
    where ...
    

    Of course, it’s up to you to determine which is the best for your application : a row with a NULL value, or no row.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a MySQL database in which I have to update a certain field
I have a database table with a certain field which should be impossible to
I have a certain web application that makes upwards of ~100 updates to an
I have updated many records already, but when it came to a word that
I have a visualforce/apex functionality that exports & emails a PDF for commission agreements
I have a trigger that checks to see if certain fields changed during the
I have a database where each entry has a file path and a last
I have a database with tables that are chained together with foreign keys, and
I have a problem with two separate transactions that are flushed to the database
I have a UIBarButtonItem in a UIToolbar that is updated with changes to a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.